Re: Radio Buttons




>In my program, I have a group of radio buttons, and I also have a button
>on the form as well.  When the user selects the button I want to go to a
>new window but I want to remember what radio button was checked in the
>group.  How do I do this?  Is there a  way to tell what radio button has
>been selected in a group?

Yep, there is a way.  gtk_toggle_button_get_active() which returns a
gboolean I believe.  If it returns TRUE, then the button is pressed.  If
not, then it's not.  Note you have to cast the radio button to a toggle
button (which should work) inside.  LIke this

GtkWidget *radio_button = gtk_radio...etc..

if(gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(radio_button)))
{
	printf("It's pressed down.");
} else printf("It's not pressed down.");

Hope that helps.  Check out the toggle button functions in
/usr/include/gtk/gtktogglebutton.h - it will give you a whole bag of
goodies you can use with radio buttons  

David

http://opop.nols.com/ Free Software Development
Der Horizont vieler Menschen ist ein Kreis mit Radius Null -- und das
nennen sie ihren Standpunkt.



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