Closed taler21 closed 3 months ago
Would
diff --git a/src/msw/notebook.cpp b/src/msw/notebook.cpp
index a0c11cd41a..9f0cbbd2d2 100644
--- a/src/msw/notebook.cpp
+++ b/src/msw/notebook.cpp
@@ -561,7 +561,7 @@ wxSize wxNotebook::CalcSizeFromPage(const wxSize& sizePage) const
const int rows = GetRowCount();
// add an extra margin in both directions
- const int MARGIN = 8;
+ const int MARGIN = FromDIP(8);
if ( IsVertical() )
{
sizeTotal.x += MARGIN;
help with this by chance?
Yes, that fixes this issue. Many thanks!
Please also backport the fix to 3.2.
Description
The minimum height of a
wxNotebook
page calculated by awxSizer
is too small at high DPI.The issue can be reproduced with the following changes to the minimal sample:
Patch for minimal sample
```patch diff --git "a/samples/minimal/minimal.cpp" "b/samples/minimal/minimal.cpp" index 5f32257c6b..d1c8492950 100644 --- "a/samples/minimal/minimal.cpp" +++ "b/samples/minimal/minimal.cpp" @@ -26,6 +26,8 @@ #include "wx/wx.h" #endif +#include "wx/notebook.h" + // ---------------------------------------------------------------------------- // resources // ---------------------------------------------------------------------------- @@ -69,6 +71,58 @@ private: wxDECLARE_EVENT_TABLE(); }; +class MyDialog : public wxDialog +{ +public: + MyDialog( wxWindow *parent ) + { + wxDialog::Create( parent, wxID_ANY, "MyDialog" ); + + CreateControls(); + GetSizer()->SetSizeHints(this); + Centre(); + } + +private: + void CreateControls(); +}; + +void MyDialog::CreateControls() +{ + wxBoxSizer *topSizer = new wxBoxSizer( wxVERTICAL ); + SetSizer( topSizer ); + +#if 1 + + wxNotebook *nb = new wxNotebook( this, wxID_ANY ); + topSizer->Add( nb, 1, wxGROW|wxALL, 5 ); + + for ( int i = 1; i <= 2; ++i ) + { + wxPanel *page = new wxPanel( nb, wxID_ANY ); + nb->AddPage( page, wxString::Format("Page %d", i) ); + + wxBoxSizer *pageSizer = new wxBoxSizer( wxVERTICAL ); + page->SetSizer( pageSizer ); + + wxWindow *check = new wxCheckBox( page, wxID_ANY, "A g j" ); + wxWindow *combo = new wxComboBox( page, wxID_ANY, "A g j" ); + + pageSizer->Add( (i == 1) ? check : combo ); + pageSizer->Add( (i == 1) ? combo : check ); + } + +#else + + wxCheckBox *check = new wxCheckBox( this, wxID_ANY, "A g j" ); + topSizer->Add( check, 0, wxALL, 0 ); + + wxComboBox *combo = new wxComboBox( this, wxID_ANY, "A g j" ); + topSizer->Add( combo, 0, wxALL, 0 ); + +#endif +} + // ---------------------------------------------------------------------------- // constants // ---------------------------------------------------------------------------- @@ -188,6 +242,10 @@ void MyFrame::OnQuit(wxCommandEvent& WXUNUSED(event)) void MyFrame::OnAbout(wxCommandEvent& WXUNUSED(event)) { + MyDialog dlg(this); + dlg.ShowModal(); + return; + wxMessageBox(wxString::Format ( "Welcome to %s!\n" ```To Reproduce:
F1
key to show the dialog with a notebook.At a DPI scaling of 100%, the calculated minimum height is correct.
At a DPI scaling of 200%, the calculated minimum height is a bit too small. The bottom control on each notebook page is displayed a bit cut off.
At a DPI scaling of 300%, the calculated minimum height is much too small. The bottom control on each notebook page is displayed even more cut off.
Platform and version information