I have got the solution from yours, g_object_set_data(). I appreciate for your help.
Regards, bkna >> -----Original Message----- >> From: [email protected] [mailto:[email protected]] On >> Behalf Of David Ne?as >> Sent: Friday, February 05, 2010 8:46 PM >> To: Ken Resander >> Cc: [email protected] >> Subject: Re: Is it possible to share a callback function in order to >> detect which a button is clicked? >> >> On Fri, Feb 05, 2010 at 03:34:08AM -0800, Ken Resander wrote: >> > I cannot see the dm userdata parameter being initialised. >> > >> > Insert dm->clicked = num; before g_signal_connect in the double- >> nested loop. >> > Then you can test on dm->clicked in the callback to check which >> > button is clicked. >> >> There is only one instance of dm in the entire program so this won't >> work, you will always get whatever was last assigned to dm->clicked. >> >> To make it work you need one dm (or whatever kind of data) per widget. >> g_object_set_data() is the mechanism to attach arbitrary data to >> objects. >> >> Yeti >> >> _______________________________________________ >> gtk-list mailing list >> [email protected] >> http://mail.gnome.org/mailman/listinfo/gtk-list _______________________________________________ gtk-list mailing list [email protected] http://mail.gnome.org/mailman/listinfo/gtk-list
