[Gtk-sharp-list] glade-sharp Autoconnect

Peter Williams peter@newton.cx
Mon, 08 Dec 2003 23:52:06 -0500


On Mon, 2003-12-08 at 23:36, Greg Hamilton wrote:
> Hi, I'm new to Mono and gtk-sharp and I've run into a problem which I 
> haven't been able to solve with the docs or Google.
> I'm trying to follow the glade example here 
> http://www.go-mono.org/tutorial/gnome/bindings/glade/glade.html.
> The c# source builds and runs and the window and button defined in the 
> glade xml file are displayed but the button click and window destroy 
> events aren't handled. The example uses autoconnect to set up the 
> connections. Is there something wrong with the example?

The example glade file is missing <signal> tags marking a function that
is supposed to be connected to a signal handler. In the Glade UI, you
can create the connections in the Signals tab of a widget. The XML tags
look something like this:

   <signal name="activate" handler="OnFileSave" />

So (warning: untested) you'd want to add lines like:

<widget class="GtkWindow" id="window2">
  <signal name="delete" handler="OnWindowDeleteEvent" />

    <widget class="GtkButton" id="button1">
      <property name="border_width">10</property>
      <signal name="clicked" handler="OnButton1Clicked" />


Peter Williams                          peter@newton.cx

"[Ninjas] are cool; and by cool, I mean totally sweet."
                              -- REAL Ultimate Power