Explicitly create all sub-controls in wxPropertyGridManager::Create()

Instead of deferring creation of wxPropertyGrid and other controls
to EVT_SIZE handler we can create them when wxPropertyGridManager
is created and its initial size is known.
This way we can avoid using a trick with magic number used as a flag
to determine when to create all controls in OnResize().

Closes #24171.
This commit is contained in:
Artur Wieczorek 2024-01-06 17:23:06 +01:00
parent 94252d84b1
commit b681a80b96

View file

@ -634,6 +634,8 @@ bool wxPropertyGridManager::Create( wxWindow *parent,
Init2(style);
SetInitialSize(size);
// Create controls
RecreateControls();
return res;
}
@ -763,9 +765,6 @@ void wxPropertyGridManager::Init2( int style )
// (see wxPropertyGridManager::ProcessEvent).
ReconnectEventHandlers(wxID_NONE, m_pPropGrid->GetId());
// Optional initial controls.
m_width = -12345;
m_iFlags |= wxPG_MAN_FL_INITIALIZED;
}
@ -2149,9 +2148,6 @@ void wxPropertyGridManager::OnResize( wxSizeEvent& WXUNUSED(event) )
GetClientSize(&width, &height);
if ( m_width == -12345 )
RecreateControls();
RecalculatePositions(width, height);
if ( m_pPropGrid && m_pPropGrid->GetParent() )