GTK+ Forums

Discussion forum for GTK+ and Programming. Ask questions, troubleshoot problems, view and post example code, or express your opinions.
It is currently Sat Sep 20, 2014 5:57 am

All times are UTC




Post new topic Reply to topic  [ 2 posts ] 
Author Message
 Post subject: Function Callback for Radio Buttons
PostPosted: Mon Apr 28, 2008 8:23 am 
Offline

Joined: Mon Apr 28, 2008 6:35 am
Posts: 1
I am new to GTK and have a question with regards to callback for radio buttons.

I have created a group of 2 radio buttons as per the GTK tutorial:


Code:
.
GtkWidget *res;
GtkWidget *vboxmjsettings;
GSList *Group_Resolution;
   
.
.

   ctx->res = gtk_radio_button_new_with_label (NULL, "500cpi");
   gtk_box_pack_start (GTK_BOX (ctx->vboxmjsettings), ctx->res, TRUE, TRUE, 0);
   gtk_widget_show (ctx->res);

   ctx->Group_Resolution = gtk_radio_button_group(GTK_RADIO_BUTTON (ctx->res));
   

   ctx->res = gtk_radio_button_new_with_label (ctx->Group_Resolution, "1000cpi");
   gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (ctx->res), TRUE);
ctx->res);
   gtk_box_pack_start (GTK_BOX (ctx->vboxmjsettings), ctx->res, TRUE, TRUE, 0);
   gtk_widget_show (ctx->res);
   GTK_WIDGET_SET_FLAGS (ctx->res, GTK_CAN_DEFAULT);




How do I attach a callback function to each of the radio button?

I am not able to use the 'g_signal_connect' function since both the '500cpi' and '1000cpi' radio buttons are not widgets. My intention is to to have each of the radio button to call a function when selected.

Appreciate if someone could help me out. Thanks in advance.[/code]


Top
 Profile  
 
 Post subject:
PostPosted: Mon Apr 28, 2008 11:02 am 
Offline
GTK+ Guru

Joined: Tue Feb 05, 2008 8:39 am
Posts: 130
GObject
+----GInitiallyUnowned
+----GtkObject
+----GtkWidget
+----GtkContainer
+----GtkBin
+----GtkButton
+----GtkToggleButton
+----GtkCheckButton
+----GtkRadioButton

So GtkRadioButton is definetly widget. If you want to detect which radiobutton causes signal, use g_object_set.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 2 posts ] 

All times are UTC


Who is online

Users browsing this forum: Google [Bot] and 3 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group