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:
parent
cc41fa5458
commit
a69fabecb1
32 changed files with 657 additions and 567 deletions
|
|
@ -27,6 +27,7 @@
|
|||
#include "wx/app.h"
|
||||
#include "wx/log.h"
|
||||
#include "wx/radiobox.h"
|
||||
#include "wx/statbox.h"
|
||||
#include "wx/textctrl.h"
|
||||
#endif
|
||||
|
||||
|
|
@ -142,16 +143,18 @@ DirPickerWidgetsPage::DirPickerWidgetsPage(WidgetsBookCtrl *book,
|
|||
void DirPickerWidgetsPage::CreateContent()
|
||||
{
|
||||
// left pane
|
||||
wxSizer *boxleft = new wxBoxSizer(wxVERTICAL);
|
||||
wxSizer *sizerLeft = new wxBoxSizer(wxVERTICAL);
|
||||
|
||||
wxStaticBoxSizer *dirbox = new wxStaticBoxSizer(wxVERTICAL, this, "&DirPicker style");
|
||||
m_chkDirTextCtrl = CreateCheckBoxAndAddToSizer(dirbox, "With textctrl");
|
||||
m_chkDirMustExist = CreateCheckBoxAndAddToSizer(dirbox, "Dir must exist");
|
||||
m_chkDirChangeDir = CreateCheckBoxAndAddToSizer(dirbox, "Change working dir");
|
||||
m_chkSmall = CreateCheckBoxAndAddToSizer(dirbox, "&Small version");
|
||||
boxleft->Add(dirbox, 0, wxALL|wxGROW, 5);
|
||||
wxStaticBoxSizer *sizerStyle = new wxStaticBoxSizer(wxVERTICAL, this, "&DirPicker style");
|
||||
wxStaticBox* const sizerStyleBox = sizerStyle->GetStaticBox();
|
||||
|
||||
boxleft->Add(CreateSizerWithTextAndButton
|
||||
m_chkDirTextCtrl = CreateCheckBoxAndAddToSizer(sizerStyle, "With textctrl", wxID_ANY, sizerStyleBox);
|
||||
m_chkDirMustExist = CreateCheckBoxAndAddToSizer(sizerStyle, "Dir must exist", wxID_ANY, sizerStyleBox);
|
||||
m_chkDirChangeDir = CreateCheckBoxAndAddToSizer(sizerStyle, "Change working dir", wxID_ANY, sizerStyleBox);
|
||||
m_chkSmall = CreateCheckBoxAndAddToSizer(sizerStyle, "&Small version", wxID_ANY, sizerStyleBox);
|
||||
sizerLeft->Add(sizerStyle, 0, wxALL|wxGROW, 5);
|
||||
|
||||
sizerLeft->Add(CreateSizerWithTextAndButton
|
||||
(
|
||||
PickerPage_SetDir,
|
||||
"&Initial directory",
|
||||
|
|
@ -159,9 +162,9 @@ void DirPickerWidgetsPage::CreateContent()
|
|||
&m_textInitialDir
|
||||
), wxSizerFlags().Expand().Border());
|
||||
|
||||
boxleft->AddSpacer(10);
|
||||
sizerLeft->AddSpacer(10);
|
||||
|
||||
boxleft->Add(new wxButton(this, PickerPage_Reset, "&Reset"),
|
||||
sizerLeft->Add(new wxButton(this, PickerPage_Reset, "&Reset"),
|
||||
0, wxALIGN_CENTRE_HORIZONTAL | wxALL, 15);
|
||||
|
||||
Reset(); // set checkboxes state
|
||||
|
|
@ -178,7 +181,7 @@ void DirPickerWidgetsPage::CreateContent()
|
|||
|
||||
// global pane
|
||||
wxSizer *sz = new wxBoxSizer(wxHORIZONTAL);
|
||||
sz->Add(boxleft, 0, wxGROW|wxALL, 5);
|
||||
sz->Add(sizerLeft, 0, wxGROW|wxALL, 5);
|
||||
sz->Add(m_sizer, 1, wxGROW|wxALL, 5);
|
||||
|
||||
SetSizer(sz);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue