Fix using wxStaticBoxSizer in samples

If a control is contained in a wxStaticBoxSizer or its child sizer,
wxStaticBoxSizer::GetStaticBox() should be used as the control's parent.

However, widgets and dialogs samples did not do that, which resulted in
flooding the message log in widgets sample with warnings about this; in
dialogs sample the warnings were shown in the debug output.

Fix this by always using the static box as the control's parent when the
control is contained (directly or indirectly) in a wxStaticBoxSizer.

Closes #23967.
This commit is contained in:
PB
2023-10-22 01:27:55 +02:00
committed by Vadim Zeitlin
parent cc41fa5458
commit a69fabecb1
32 changed files with 657 additions and 567 deletions
+8 -5
View File
@@ -27,6 +27,7 @@
#include "wx/app.h"
#include "wx/log.h"
#include "wx/radiobox.h"
#include "wx/statbox.h"
#endif
#include "wx/artprov.h"
@@ -141,11 +142,13 @@ void ColourPickerWidgetsPage::CreateContent()
// left pane
wxSizer *boxleft = new wxBoxSizer(wxVERTICAL);
wxStaticBoxSizer *clrbox = new wxStaticBoxSizer(wxVERTICAL, this, "&ColourPicker style");
m_chkColourTextCtrl = CreateCheckBoxAndAddToSizer(clrbox, "With textctrl");
m_chkColourShowLabel = CreateCheckBoxAndAddToSizer(clrbox, "With label");
m_chkColourShowAlpha = CreateCheckBoxAndAddToSizer(clrbox, "With opacity");
boxleft->Add(clrbox, 0, wxALL|wxGROW, 5);
wxStaticBoxSizer *styleSizer = new wxStaticBoxSizer(wxVERTICAL, this, "&ColourPicker style");
wxStaticBox* const styleSizerBox = styleSizer->GetStaticBox();
m_chkColourTextCtrl = CreateCheckBoxAndAddToSizer(styleSizer, "With textctrl", wxID_ANY, styleSizerBox);
m_chkColourShowLabel = CreateCheckBoxAndAddToSizer(styleSizer, "With label", wxID_ANY, styleSizerBox);
m_chkColourShowAlpha = CreateCheckBoxAndAddToSizer(styleSizer, "With opacity", wxID_ANY, styleSizerBox);
boxleft->Add(styleSizer, 0, wxALL|wxGROW, 5);
boxleft->Add(new wxButton(this, PickerPage_Reset, "&Reset"),
0, wxALIGN_CENTRE_HORIZONTAL | wxALL, 15);