Re: Two events when selecting a RadioButton
- From: Robert Pearce <rob bdt-home demon co uk>
- To: gtkmm-list gnome org
- Subject: Re: Two events when selecting a RadioButton
- Date: Sun, 18 Dec 2011 09:28:19 +0000
Hi lecas,
On Sun, 18 Dec 2011 02:23:35 +0000 you wrote:
> Hi,
>
> I have some RadioButton's with a function attached to the
> signal_clicked() event.
>
> When I select a RadioButton, I get two events, one for the previous
> RadioButton that was active, and then another for the RadioButton that
> I actually selected.
> If I press the one that is already active, I only get one event.
>
> My question is why does two events are triggered? If I just clicked on
> one of them, I should just get one event.
The signal_slicked for radio buttons doesn't do what it says at all! If
you check out the thread "Weird RadioButton behaviour" from back in
May, I was having troubles with it for slightly different reasons.
I suspect, though I haven't examined the code, that signal_clicked is
actually emitted by any action on the button, including keyboard
shortcuts, but more importantly including internal state changes. When
you select button x in a group where button y is active, GTK must
deactivate button y, and I suspect the mechanism it uses internally is
the underlying ToggleButton's clicked event.
In reality, it's actually quite useful sometimes to receive a signal
when a RadioButton is deactivated by one of the others in the group.
It's also fairly easy to tell the real click from the remote
deactivation, because in the former case the button will be active when
your function is called, and in the latter it won't.
HTH
Rob
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]