RE: how to get the active button in a GList



Connect a signal handler to each button via;

gtk_signal_connect(GTK_OBJECT(radio_button), "clicked",
GTK_SIGNAL_FUNC(check_if_active_button), NULL);

Then within the callback put the following "if" conditional;

void check_if_active_button ( GtkWidget button, gpointer user_data )
{
	if ( GTK_TOGGLE_BUTTON(button)->active )
	{
	/* perform action here */
	}
}

[Note: the reason why you need to check for the "active" widget is because the
previously selected button will emit a "clicked" signal when is becomes
"deselected"]

Hope this helps.



				-- Stupid Genius

> ----------
> From: 	Ronald Bultje[SMTP:rbultje ronald bitfreak net]
> Sent: 	Thursday, February 01, 2001 12:21 PM
> To: 	gtk-list gnome org
> Subject: 	how to get the active button in a GList
> 
> hi there,
> 
> if I have a group of radio buttons, grouped in a GSList, how would I get
> the "active" button out of this GSList?
> 
> Ronald Bultje
> 
> 
> _______________________________________________
> gtk-list mailing list
> gtk-list gnome org
> http://mail.gnome.org/mailman/listinfo/gtk-list
> 




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