utilities: Fix CheckedStaticBox behaviour

Avoid enabling the child windows when SetValue is called if the window
is currently disabled.

Also continue processing the checkbox event after it has been handled,
which allows the event to propagate to the parent window.
This commit is contained in:
Jonathan Li 2018-02-03 23:51:50 +00:00
parent ff68ad61e7
commit 629bb23832
1 changed files with 2 additions and 1 deletions

View File

@ -35,6 +35,7 @@ CheckedStaticBox::CheckedStaticBox(wxWindow *parent, int orientation, const wxSt
void CheckedStaticBox::MainToggle_Click(wxCommandEvent &evt)
{
SetValue(evt.IsChecked());
evt.Skip();
}
// Sets the main checkbox status, and enables/disables all child controls
@ -46,7 +47,7 @@ void CheckedStaticBox::SetValue(bool val)
for (wxWindowList::iterator iter = list.begin(); iter != list.end(); ++iter) {
wxWindow *current = *iter;
if (current != &ThisToggle)
current->Enable(val);
current->Enable(IsEnabled() && val);
}
ThisToggle.SetValue(val);
}