[Gtk-sharp-list] Glade# signal/handler pass object

Alejandro Sánchez alejasanch@yahoo.es
Mon, 24 Nov 2003 18:39:58 +0100


On Mon, 2003-11-24 at 08:01, Leo Spalteholz wrote:
> On November 23, 2003 10:37 pm, Leo Spalteholz wrote:
> > On November 23, 2003 04:16 pm, Alejandro Sánchez wrote:
> > > I have a glade object
> > >
> > > <widget class="GtkButton" id="button">
> > >   <property name="width_request">15</property>
> > >   <property name="height_request">15</property>
> > >   <property name="visible">True</property>
> > >   <property name="relief">GTK_RELIEF_NONE</property>
> > >   <signal name="clicked" handler="OnButtonClicked" object="widg=
et"
> > > last_modification_time="Sat, 22 Nov 2003 15:56:35 GMT"/>
> > >
> > > How would be OnButtonClicked declaration in C#? How to retrieve objec=
t
> > > "widget" in the function?
> > >
> > > And with all in C# code?
> > >
> > > Button button = new Button;
> >
> > should be: Button button = new Button();
> >
> > > button.Clicked += new EventHandler(OnButtonClicked);
> >
> > void OnButtonClicked(object obj, EventArgs args) {
> > 	// get widget, in this case your button
> > 	Button button = (Button)(obj);
> > }

i have that with a "Console.Write("Clicked")" and it works but i don't
need "button", i need "widget", another widget or object in general. In
C/Gtk+:

g_singnal_connect ( G_OBJECT (button), "clicked",
		    G_CALLBACK (OnButtonClicked), G_OBJECT (widget) ); 

OnButtonClicked (GtkButton *button, gpointer user_data)
{
	GtkWidget *widget = user_data;
}

How i put "widget" in EventArgs and retreive it?

> >
> > Leo
> 
> On second read..  Did you want the pure C# way of doing it or how to do i=
t 
> with glade#?  Well the above is how to do it in C#...   Sorry, I don't 
> know anything about glade#.
> 
> leo
> 

Two ways, tell me what you know.

Thanks

> _______________________________________________
> Gtk-sharp-list maillist  -  Gtk-sharp-list@lists.ximian.com
> http://lists.ximian.com/mailman/listinfo/gtk-sharp-list
--