From 96f9a1289878570e3d5104252d6da660f11d8459 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Sun, 25 Mar 2018 00:19:57 +0100 Subject: [PATCH] Stop resizing widgets sample pages when first showing them The size of wxBookCtrl pages is determined by wxBookCtrl and can't be changed, yet the sample tried to do it, making them larger than the actually available space and cutting them off as the result. Just stop doing this and simply layout the page using the available space -- if there is not enough of it, that's too bad, but the user can always resize the main window in this case. See #4379. --- samples/widgets/widgets.cpp | 15 +-------------- 1 file changed, 1 insertion(+), 14 deletions(-) diff --git a/samples/widgets/widgets.cpp b/samples/widgets/widgets.cpp index 12e471fe26..2b5dfe9082 100644 --- a/samples/widgets/widgets.cpp +++ b/samples/widgets/widgets.cpp @@ -724,20 +724,7 @@ void WidgetsFrame::OnPageChanged(WidgetsBookCtrlEvent& event) { wxWindowUpdateLocker noUpdates(curPage); curPage->CreateContent(); - //curPage->Layout(); - curPage->GetSizer()->Fit(curPage); - - WidgetsBookCtrl *book = wxStaticCast(curPage->GetParent(), WidgetsBookCtrl); - wxSize size; - for ( size_t i = 0; i < book->GetPageCount(); ++i ) - { - wxWindow *page = book->GetPage(i); - if ( page ) - { - size.IncTo(page->GetSize()); - } - } - curPage->SetSize(size); + curPage->Layout(); } // re-apply the attributes to the widget(s) curPage->SetUpWidget();