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.)
This commit is contained in:
Maarten Bent
2018-05-17 19:49:30 +02:00
parent 5758832a6e
commit c97963fce0

View File

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