From e0cd2c637d9db99dea277af5f5f89e4fc2c419c3 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Sat, 7 Aug 2021 17:35:34 +0100 Subject: [PATCH] Use a panel in internat sample to make it look better under MSW Creating the controls directly on wxFrame is not recommended and looks ugly under MSW due to the wrong background being used, so add an intermediate panel. --- samples/internat/internat.cpp | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/samples/internat/internat.cpp b/samples/internat/internat.cpp index e9700dd89c..7e00f1dbc5 100644 --- a/samples/internat/internat.cpp +++ b/samples/internat/internat.cpp @@ -378,16 +378,18 @@ MyFrame::MyFrame(wxLocale& locale) // this demonstrates RTL support in wxStatusBar: CreateStatusBar(1); + wxPanel* const panel = new wxPanel(this); + // create some controls affected by the locale wxSizer* const topSizer = new wxBoxSizer(wxVERTICAL); // this demonstrates RTL layout mirroring for Arabic locales and using // locale-specific decimal separator in wxSpinCtrlDouble. wxSizer *sizer = new wxBoxSizer(wxHORIZONTAL); - sizer->Add(new wxStaticText(this, wxID_ANY, _("Numeric input:")), + sizer->Add(new wxStaticText(panel, wxID_ANY, _("Numeric input:")), wxSizerFlags().Center().Border()); - wxSpinCtrlDouble* const spin = new wxSpinCtrlDouble(this, wxID_ANY); + wxSpinCtrlDouble* const spin = new wxSpinCtrlDouble(panel, wxID_ANY); spin->SetDigits(2); spin->SetValue(12.34); sizer->Add(spin, wxSizerFlags().Center().Border()); @@ -395,7 +397,7 @@ MyFrame::MyFrame(wxLocale& locale) topSizer->Add(sizer, wxSizerFlags().Center()); // show that week days and months names are translated too - topSizer->Add(new wxCalendarCtrl(this, wxID_ANY), + topSizer->Add(new wxCalendarCtrl(panel, wxID_ANY), wxSizerFlags().Center().Border()); // show the difference between wxString::Format() and wxNumberFormatter: @@ -403,7 +405,7 @@ MyFrame::MyFrame(wxLocale& locale) // locale topSizer->Add(new wxStaticText ( - this, + panel, wxID_ANY, wxString::Format ( @@ -414,7 +416,8 @@ MyFrame::MyFrame(wxLocale& locale) ), wxSizerFlags().Center().Border()); - SetSizerAndFit(topSizer); + panel->SetSizer(topSizer); + topSizer->SetSizeHints(this); } void MyFrame::OnQuit(wxCommandEvent& WXUNUSED(event) )