mirror of
https://github.com/wxWidgets/wxWidgets.git
synced 2026-08-17 08:53:06 +08:00
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:
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user