From 629bb23832dd2b1d2ed1e8a2f3309fa8046b385e Mon Sep 17 00:00:00 2001 From: Jonathan Li Date: Sat, 3 Feb 2018 23:51:50 +0000 Subject: [PATCH] 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. --- common/src/Utilities/CheckedStaticBox.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/common/src/Utilities/CheckedStaticBox.cpp b/common/src/Utilities/CheckedStaticBox.cpp index 388bf1327e..e0e57cb8c3 100644 --- a/common/src/Utilities/CheckedStaticBox.cpp +++ b/common/src/Utilities/CheckedStaticBox.cpp @@ -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); }