Hi. > I have an application on which a group of RadioButtons select the > control mode. The modes that are not "in control" show the current > reading, while the "in control" has a SpinButton. To do this widget > switching I have hooked up to the signal_toggled and signal_clicked of > the RadioButtons and in the handler I check the get_state() value. > > This works fine when I click on the radio buttons with the mouse. The > callback is invoked four times; twice on the old selection with the > get_state returning false, then twice on the new with get_state() true. > I don't know which order the clicked and toggled signals occur but it > doesn't really matter. I am slightly surprised that I get two events on > the old Âbutton - I haven't clicked it, after all. I did have similar troubles quite some time ago. IIRC, the problems were caused by the fact that GtkButton::clicked is an action signal that gets emitted quite a lot by GTK+ itself. It's been a while since I last looked at GTK+'s sources, but I think that chain of events/signals that lead to observed behavior is: Clicking with a mouse: GtkToggleButton::button-released -> GtkButton::clicked -> GtkToggleButton::toggled Not sure what would chain for keyboard navigation be, but I'm almost sure that state change is done via GtkButton::clicked signal. > The problem is when I use the cursor keys to change button. Most times > it works the same, but often (and it seems to usually be most times I > move away from a particular button) the two signals sent by the > "leaving" button happen with its get_state() still returning true. > > Presumably this is a race condition of some sort, but why is it so > consistently problematic on keyboard actions and never on mouse? Is > there a better way to do the whole thing? Why do you connect to both GtkButton::clicked and GtkToggleButton::toggled signals? It would probably be better to only connect to toggled one. Hope this helps a bit, Tadej -- Tadej BorovÅak tadeboro.blogspot.com tadeboro@xxxxxxxxx tadej.borovsak@xxxxxxxxx _______________________________________________ gtk-list mailing list gtk-list@xxxxxxxxx http://mail.gnome.org/mailman/listinfo/gtk-list