From c97963fce0152bab0c145ec85d5cf77b4f3cafc3 Mon Sep 17 00:00:00 2001 From: Maarten Bent Date: Thu, 17 May 2018 19:49:30 +0200 Subject: [PATCH] Fix size glitch of WidgetsBookCtrl in widgets sample The entire control is hidden until the dialog is resized. This seems to be caused by (recent changes in) the wxPersistentManager. This is fixed by populating the frame before restoring persistence. (as is described in docs/doxygen/overviews/persistence.h.) --- samples/widgets/widgets.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/samples/widgets/widgets.cpp b/samples/widgets/widgets.cpp index 2b5dfe9082..cb42f7d16e 100644 --- a/samples/widgets/widgets.cpp +++ b/samples/widgets/widgets.cpp @@ -381,8 +381,6 @@ bool WidgetsApp::OnInit() WidgetsFrame::WidgetsFrame(const wxString& title) : wxFrame(NULL, wxID_ANY, title) { - const bool sizeSet = wxPersistentRegisterAndRestore(this, "Main"); - // set the frame icon SetIcon(wxICON(sample)); @@ -514,6 +512,8 @@ WidgetsFrame::WidgetsFrame(const wxString& title) m_panel->SetSizer(sizerTop); + const bool sizeSet = wxPersistentRegisterAndRestore(this, "Main"); + const wxSize sizeMin = m_panel->GetBestSize(); if ( !sizeSet ) SetClientSize(sizeMin);