I'm having an issue with multi-line notebooks in 3.1.4 on MSW.
When the notebook is created *without* the multi-line flag, it behaves as expected:
However, when it's created *with* the multi-line flag, the sizing goes bananas, see how the parent panel becomes taller for no reason:
Here's the code I'm using for this example:
Code: Select all
MyFrame::MyFrame(const wxString& title)
: wxFrame(
nullptr,
wxID_ANY,
title,
wxDefaultPosition,
wxDefaultSize,
wxDEFAULT_FRAME_STYLE | wxMAXIMIZE,
_T("Main Frame"))
{
wxBoxSizer * dialogVSizer = new wxBoxSizer(wxVERTICAL);
wxNotebook * notebook = new wxNotebook(
this,
wxID_ANY,
wxDefaultPosition,
wxDefaultSize,
wxNB_TOP | wxNB_MULTILINE | wxNB_NOPAGETHEME);
{
wxPanel * panel = new wxPanel(notebook);
wxBoxSizer * sizer = new wxBoxSizer(wxVERTICAL);
sizer->AddSpacer(50);
wxButton * button = new wxButton(panel, wxID_ANY, "Button 1 With Some Long Label");
sizer->Add(button, 0, wxALL, 10);
sizer->AddSpacer(20);
panel->SetSizer(sizer);
notebook->AddPage(panel, _("Page 1"));
}
{
wxPanel * panel = new wxPanel(notebook);
wxBoxSizer * sizer = new wxBoxSizer(wxVERTICAL);
sizer->AddSpacer(50);
wxButton * button = new wxButton(panel, wxID_ANY, "Button 2 With Some Longer Label");
sizer->Add(button, 0, wxALL, 10);
sizer->AddSpacer(20);
panel->SetSizer(sizer);
notebook->AddPage(panel, _("Page 2"));
}
dialogVSizer->Add(notebook, 0);
SetSizerAndFit(dialogVSizer);
Centre(wxCENTER_ON_SCREEN | wxBOTH);
}