From e0321c2ddf9732e5b3e6b6473cb9e49e8c27b013 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Sat, 4 Apr 2026 15:25:02 +0200 Subject: [PATCH] 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. --- samples/notebook/notebook.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/samples/notebook/notebook.cpp b/samples/notebook/notebook.cpp index 57500b8c74..a52015bd38 100644 --- a/samples/notebook/notebook.cpp +++ b/samples/notebook/notebook.cpp @@ -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; }