Avoid setting layout direction to wxLayout_Default in widgets sample

wxMSW doesn't support setting wxLayout_Default
This commit is contained in:
Paul Cornett
2021-03-11 08:49:59 -08:00
parent 28d705424b
commit 679c3ef714

View File

@@ -973,10 +973,13 @@ void WidgetsFrame::OnSetVariant(wxCommandEvent& event)
CurrentPage()->Layout(); CurrentPage()->Layout();
} }
void WidgetsFrame::OnToggleLayoutDirection(wxCommandEvent& event) void WidgetsFrame::OnToggleLayoutDirection(wxCommandEvent&)
{ {
WidgetsPage::GetAttrs().m_dir = event.IsChecked() ? wxLayout_RightToLeft wxLayoutDirection dir = WidgetsPage::GetAttrs().m_dir;
: wxLayout_LeftToRight; if (dir == wxLayout_Default)
dir = GetLayoutDirection();
WidgetsPage::GetAttrs().m_dir =
(dir == wxLayout_LeftToRight) ? wxLayout_RightToLeft : wxLayout_LeftToRight;
CurrentPage()->SetUpWidget(); CurrentPage()->SetUpWidget();
} }
@@ -1354,7 +1357,8 @@ void WidgetsPage::SetUpWidget()
(*it)->SetBackgroundColour(GetAttrs().m_colBg); (*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)->Enable(GetAttrs().m_enabled);
(*it)->Show(GetAttrs().m_show); (*it)->Show(GetAttrs().m_show);