Fix layout of new page in the notebook sample

Use sizer to position the buttons on the new pages instead of hardcoding
the buttons positions which, unsurprisingly, didn't work well and
resulted in buttons overlapping each other in high DPI.
This commit is contained in:
Vadim Zeitlin
2026-04-04 15:25:02 +02:00
parent 657960fc0a
commit e0321c2ddf
+7 -2
View File
@@ -635,8 +635,13 @@ wxPanel *MyFrame::CreateNewPage() const
panel->SetHelpText("Panel with \"First\" and \"Second\" buttons");
#endif
(void) new wxButton(panel, wxID_ANY, "First button", wxPoint(10, 30));
(void) new wxButton(panel, wxID_ANY, "Second button", wxPoint(150, 30));
wxBoxSizer* const sizer = new wxBoxSizer(wxHORIZONTAL);
panel->SetSizer(sizer);
sizer->Add(new wxButton(panel, wxID_ANY, "First button"),
wxSizerFlags().Border());
sizer->Add(new wxButton(panel, wxID_ANY, "Second button"),
wxSizerFlags().Border());
return panel;
}