kicad-developers team mailing list archive
Mailing list archive
Re: wxUpdateUIEvent abuse
In the light of below finding, is this review comment still valid?
It belonged to my changes for initial conditions.
Dnia 27 czerwca 2019 21:04 Wayne Stambaugh <stambaughw@xxxxxxxxx>
> Get rid of DIALOG_SIM_SETTINGS::disableCtrlOnCheckboxEvent() and use the
> appropriate wxUpdateUIEvent handler to enable and/or disable any
> controls. Manually doing this will almost certainly lead to broken
> control states. We have done this poorly so many times in the past that
> I am not allowing it in new code.
As I understand wxUpdateUIEvent is useful for scenarios like this or
> 1. Application wants to connect to target hardware.
> 2. State of hardware changes - application updates status on GUI.
> 3. Connectivity is lost - some functions on GUI become grayed.
Thanks to wxUpdateUIEvent GUI update can be processed separate from
When we want to change state of controls depending on other controls
we can use simply event handlers. The same logic can be applied to the
multiple events or multiple controls, like in dialog_spice_model_base.fbp,
field m_modelName, events OnCombobox and OnText.
On 18/09/2019 22:01, Wayne Stambaugh wrote:
Given the recent rash of odd dialog UI behavior, I did some digging and
it appears that we might be abusing wxUpdateUIEvent. This event
handler was specifically designed for updating controls that respond to
command events such as menus, toolbars, buttons, etc. Using them for
anything else is risky. I would avoid using UI control object calls
inside a wxUpdaetUIEvent handler other than those provided by the
wxUpdateUIEvent object itself. I'm pretty sure making changes to a
control inside a wxUpdateUIEvent handler can spawn an event loop where
the changes made to the control generate a new wxUpdateUIEvent. A
better solution might be to use wxIdleEvent to do any dialog control
post processing as a one shot.
Mailing list: https://launchpad.net/~kicad-developers
Post to : kicad-developers@xxxxxxxxxxxxxxxxxxx
Unsubscribe : https://launchpad.net/~kicad-developers
More help : https://help.launchpad.net/ListHelp