Page 1 of 1

Event Behavior: Enabled vs Disabled

Posted: Sun Oct 15, 2006 15:39
by Van
When the data/state of a widget is changed while disabled, why do events fire off when the widget is (re)enabled?

For example:
We have validation events subscribed to checkboxes (and other widgets too) that are tied to the CEGUI::Checkbox::EventCheckStateChanged event. When we are changing the checkbox, we DISABLE it because we don't want the event to fire. However, after we change the checkbox state and then ENABLE the checkbox the event fires PRIOR to the user changing the state of teh checkbox. It seems that the checkbox is instantly reacting to the state change while it was disabled. Is this behavior correct?

Implemenation:
This doesn't make since to us. We display data "as it is now" and then permit the user to change it. When a "change" occurs to the data we enable the "CANCEL and COMMIT" buttons. If the user hit's CANCEL, we disable all the widgets, reset the data back to "as it is now" and then re-enable the widgets. However, the "CHANGE" events are still being fired when the widget it is re-enabled. It makes more since that envents only fire when the widget is enabled. If the state changes while disabled, then don't fire the event.

Posted: Sun Oct 15, 2006 19:45
by Gaal
Instead of disabling the widget, try to use "setMutedState(true)" before you change any property, then "setMutedState(False)" after when you want the widget reacts again to your user.

Posted: Sun Oct 15, 2006 19:45
by CrazyEddie
To gaurantee that no events get fired, you should be using the method EventSet::setMutedState.

HTH

CE.

Posted: Sun Oct 15, 2006 19:46
by Gaal
I got it first .. :lol: :lol: :lol:

Posted: Sun Oct 15, 2006 19:48
by CrazyEddie
Bah!

:lol: