RE: A question about radio button



I'm not aware of a single function that does this.  However, there are 2 ways of
gettting this information that I can think of using
gtk_toggle_button_get_active() - which returns TRUE if a button is active;

(1) connect to the "toggled" signal for each radio button and determine the
active button using "gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON(
radio_button ) )" in your callback function.  Note: This is necessary because
the previously selected radio button emits the "toggled" signal when it
de-activates in addtion to the newly selected button emitting the "toggled"
signal when it activates.

(2) get a singly linked list (i.e. a GSList) of all the radio buttons in a
particular group using gtk_radio_button_group() and perform a check on each
button in the list until you find the active button using
"gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON( radio_button ) )".

Hope this helps.



                                -- Stupid Genius
P.S.
a GSList is defined in glib.h as;

typedef struct _GSList GSList;

struct _GSList
{
        gpointer  data;         /* in this example data would be a radio button
*/
        GSList    *next;                /* a pointer to the next GSList in the
linked list or NULL if data is the last item in the linked list */
};

----------
From:         Jiang[SMTP:jiangh1999 263 net]
Reply To:     wildcrane chinaren com
Sent:         Sunday, October 29, 2000 8:14 AM
To:   GTK Application Development List
Subject:      A question about radio button

Hi, Everyone,
I am a beginner in GTK. I  wonder whether there is some function that will
tell which radio button is currently active in a group of radio button. Maybe
that will need to follow through the linked list, but I am not clear about the
operation of  GSList . Would you help me? 
Thanks for your considerations!   

-- 


_______________________________________________
gtk-app-devel-list mailing list
gtk-app-devel-list gnome org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list





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