From 679c3ef7143e4f65d6bbe11ed60ce965e1230c69 Mon Sep 17 00:00:00 2001 From: Paul Cornett Date: Thu, 11 Mar 2021 08:49:59 -0800 Subject: [PATCH] Avoid setting layout direction to wxLayout_Default in widgets sample wxMSW doesn't support setting wxLayout_Default --- samples/widgets/widgets.cpp | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/samples/widgets/widgets.cpp b/samples/widgets/widgets.cpp index ee36bde0c8..0ac3997c1c 100644 --- a/samples/widgets/widgets.cpp +++ b/samples/widgets/widgets.cpp @@ -973,10 +973,13 @@ void WidgetsFrame::OnSetVariant(wxCommandEvent& event) CurrentPage()->Layout(); } -void WidgetsFrame::OnToggleLayoutDirection(wxCommandEvent& event) +void WidgetsFrame::OnToggleLayoutDirection(wxCommandEvent&) { - WidgetsPage::GetAttrs().m_dir = event.IsChecked() ? wxLayout_RightToLeft - : wxLayout_LeftToRight; + wxLayoutDirection dir = WidgetsPage::GetAttrs().m_dir; + if (dir == wxLayout_Default) + dir = GetLayoutDirection(); + WidgetsPage::GetAttrs().m_dir = + (dir == wxLayout_LeftToRight) ? wxLayout_RightToLeft : wxLayout_LeftToRight; CurrentPage()->SetUpWidget(); } @@ -1354,7 +1357,8 @@ void WidgetsPage::SetUpWidget() (*it)->SetBackgroundColour(GetAttrs().m_colBg); } - (*it)->SetLayoutDirection(GetAttrs().m_dir); + if (GetAttrs().m_dir != wxLayout_Default) + (*it)->SetLayoutDirection(GetAttrs().m_dir); (*it)->Enable(GetAttrs().m_enabled); (*it)->Show(GetAttrs().m_show);