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.
This commit is contained in:
Vadim Zeitlin
2018-03-25 00:19:57 +01:00
parent 02a92e23f3
commit 96f9a12898

View File

@@ -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();