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 committed 2018-02-28 01:19:12 +00:00
1 parent ff68ad61e7
commit 629bb23832
1 file changed
+2 -1
+2 -1
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);
}