[Gtk-sharp-list] Userdata in signal handlers?
ngeor at freemail.gr
Mon Feb 19 06:02:12 EST 2007
Jesper K. Pedersen wrote:
> Is it possible to attach a piece of userdata to each button with a
> value that makes it easy to check which button was calling the event
I searched a bit in the documentation but I didn't find anything useful.
The GLib.Object does have some methods for getting and setting custom
properties but they are protected.
Since you're using Glade, I would map those Gtk.Button objects to some
private Gtk.Button btnOne;
private Gtk.Button btnTwo;
private void on_SomeButton_clicked(object sender,
if (sender == btnOne)
System.Console.WriteLine("Hello from first button");
else if (sender == btnTwo)
System.Console.WriteLine("Hello from second button");
System.Console.WriteLine("This is quite interesting");
Oh and check out the Glade# Code Generator:
it can produce the glade code for you.
More information about the Gtk-sharp-list