Weird RadioButton behaviour



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.

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?

Thanks,
Rob


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