mirror of
https://github.com/wxWidgets/wxWidgets.git
synced 2026-09-21 13:26:08 +08:00
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:
@@ -130,16 +130,15 @@ void EditableListboxWidgetsPage::CreateContent()
|
||||
wxSizer *sizerTop = new wxBoxSizer(wxHORIZONTAL);
|
||||
|
||||
// left pane
|
||||
wxStaticBox *box = new wxStaticBox(this, wxID_ANY,
|
||||
"&Set listbox parameters");
|
||||
wxSizer *sizerLeft = new wxStaticBoxSizer(box, wxVERTICAL);
|
||||
wxStaticBoxSizer *sizerLeft = new wxStaticBoxSizer(wxVERTICAL, this, "&Set listbox parameters");
|
||||
wxStaticBox* const sizerLeftBox = sizerLeft->GetStaticBox();
|
||||
|
||||
m_chkAllowNew = CreateCheckBoxAndAddToSizer(sizerLeft, "Allow new items");
|
||||
m_chkAllowEdit = CreateCheckBoxAndAddToSizer(sizerLeft, "Allow editing items");
|
||||
m_chkAllowDelete = CreateCheckBoxAndAddToSizer(sizerLeft, "Allow deleting items");
|
||||
m_chkAllowNoReorder = CreateCheckBoxAndAddToSizer(sizerLeft, "Block user reordering");
|
||||
m_chkAllowNew = CreateCheckBoxAndAddToSizer(sizerLeft, "Allow new items", wxID_ANY, sizerLeftBox);
|
||||
m_chkAllowEdit = CreateCheckBoxAndAddToSizer(sizerLeft, "Allow editing items", wxID_ANY, sizerLeftBox);
|
||||
m_chkAllowDelete = CreateCheckBoxAndAddToSizer(sizerLeft, "Allow deleting items", wxID_ANY, sizerLeftBox);
|
||||
m_chkAllowNoReorder = CreateCheckBoxAndAddToSizer(sizerLeft, "Block user reordering", wxID_ANY, sizerLeftBox);
|
||||
|
||||
wxButton *btn = new wxButton(this, EditableListboxPage_Reset, "&Reset");
|
||||
wxButton *btn = new wxButton(sizerLeftBox, EditableListboxPage_Reset, "&Reset");
|
||||
sizerLeft->Add(btn, 0, wxALIGN_CENTRE_HORIZONTAL | wxALL, 15);
|
||||
|
||||
// right pane
|
||||
|
||||
Reference in New Issue
Block a user