From b681a80b961de812f96bb8567d93e01ea7366e83 Mon Sep 17 00:00:00 2001 From: Artur Wieczorek <7330332+a-wi@users.noreply.github.com> Date: Sat, 6 Jan 2024 17:23:06 +0100 Subject: [PATCH] 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. --- src/propgrid/manager.cpp | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/src/propgrid/manager.cpp b/src/propgrid/manager.cpp index e4e3d33de1..639b71991c 100644 --- a/src/propgrid/manager.cpp +++ b/src/propgrid/manager.cpp @@ -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() )