[Date Prev][Date Next] [Thread Prev][Thread Next]
[Thread Index]
[Date Index]
[Author Index]
Re: Radio Buttons
- From: Carlos Pereira <carlos pehoe civil ist utl pt>
- To: gtk-app-devel-list gnome org
- Subject: Re: Radio Buttons
- Date: Wed, 17 Oct 2001 19:17:50 +0100
>Does anyone know how you can detect which Radio button has been selected. I
>have three radio buttons and a normal button. The user selectes a radio
>button then selects the normal button. I need to know how to detect which
>radio button is depressed from the function called by the normal button.
See the example below,
(of course there are other ways of doing this)
Carlos
---------------------------------------
/* callback: get radio buttons */
button = (GtkWidget *) gtk_object_get_data (GTK_OBJECT (dialog), "radio_button_a");
if (GTK_TOGGLE_BUTTON (button)->active == TRUE) do_stuff_a;
button = (GtkWidget *) gtk_object_get_data (GTK_OBJECT (dialog), "radio_button_b");
if (GTK_TOGGLE_BUTTON (button)->active == TRUE) do_stuff_b;
button = (GtkWidget *) gtk_object_get_data (GTK_OBJECT (dialog), "radio_button_c");
if (GTK_TOGGLE_BUTTON (button)->active == TRUE) do_stuff_c;
/* main: create radio buttons */
button = gtk_radio_button_new_with_label (NULL, "a");
gtk_object_set_data (GTK_OBJECT (dialog), "radio_button_a", button);
gtk_widget_show (button);
button = gtk_radio_button_new_with_label (
gtk_radio_button_group (GTK_RADIO_BUTTON (button)), "b");
gtk_object_set_data (GTK_OBJECT (dialog), "radio_button_b", button);
gtk_widget_show (button);
button = gtk_radio_button_new_with_label (
gtk_radio_button_group (GTK_RADIO_BUTTON (button)), "c");
gtk_object_set_data (GTK_OBJECT (dialog), "radio_button_c", button);
gtk_widget_show (button);
[Date Prev][Date Next] [Thread Prev][Thread Next]
[Thread Index]
[Date Index]
[Author Index]