Toggle Button problem

Hi everyone -

I was hoping if someone could explain why the following is a feature
and not a bug : when the gtk_toggle_button_set_active method is
called, two events are fired - a "toggled" event and a "clicked"
event.  This doesn't seem to make sense if the Toggle Button isn't
actually being clicked, and doesn't seem to allow a test for the
"active" field being toggled without being clicked.

This behaviour is mentioned on this page in the GTK+-2.0 Tutorial :

but I can't find any mention of it in the API reference manual, so I
was wondering if it was a mistake.

I'm actually using gtk-sharp, and trying to override the OnClicked
method for a CheckButton.  The CheckButton is supposed to directly
indicate the value of a boolean on a server, so I'm overriding the
OnClicked event to allow a validation routine to run before allowing
the sate of the CheckButton to change.  However, once validation
completes, I change the state of the "active" field, but this causes a
clicked event to fire.  The program thinks the user has clicked on the
CheckButton again, but no such thing happened!  The validation routine
runs again, which causes "active" to change which causes another
clicked event, and so on and so on...

So, in my opinion, this isn't the correct behaviour, and changing
"active" should NOT fire a clicked event.  If I'm wrong and this *is*
the correct behaviour, could someone explain *why* it is the correct

Many thanks,

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