Re: Question about getting button signals.



"Brian Wagener" <panic force ath cx> writes:

Hi!

You can send data to the callback. If you use libxml to connect callbacks
to the signals you can use:

       glade_xml_signal_connect_data   (gui, "button1_pressed",
                                        &button_pressed_cb, (gpointer) "Button1");

Your callback could then look like:

void 
button_pressed_cb (GtkWidget *button, gpointer user_data) {

       gchar *msg = (gchar *)user_data;

       if (!strcmp ("Button1", msg)) { 
               g_print ("Button1 was pressed\n");
       }
}

Good luck!

Regards,
Mikael Hallendal

> Hello,
> I am making a gtk app using libglade, and have a question about
> connecting signals to buttons.  I want to connect a collection of
> buttons to one signal handler, but I am having problems telling what
> button was pressed.  What is the best way to do this?
> Thanks.
> Brian Wagener
> 
> -- 
> ForceConstant
> http://force.ath.cx
> http://shoptalk.tunacan.net
> 
> _______________________________________________
> gtk-devel-list mailing list
> gtk-devel-list gnome org
> http://mail.gnome.org/mailman/listinfo/gtk-devel-list
> 

-- 
+------------------------------------
| email    : micke hallendal net
| sms      : micke mobil hallendal net
| PGP-key  : www.hallendal.net/~micke/mikhal.txt
+------------------------------------------------------
| "Light travels faster than sound.  That's why some 
|  people appear bright until you hear them speak"
+------------------------------------------------------




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]