From a07c14a31d63bf002acf8f583c7e5b8e6bad5902 Mon Sep 17 00:00:00 2001 From: Artur Wieczorek Date: Mon, 20 May 2019 18:58:58 +0200 Subject: [PATCH] Fix calculation of column width after changing number of wxPropertyGrid columns Because changing the number of columns may change their total width from value greater than current client size to the value less than this size or vice versa we need to know this total width prior to determining wxProperyGrid scrolled view in order to account this actual width in the calculations. --- src/propgrid/propgridpagestate.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/propgrid/propgridpagestate.cpp b/src/propgrid/propgridpagestate.cpp index 5e37752801..2e925ede48 100644 --- a/src/propgrid/propgridpagestate.cpp +++ b/src/propgrid/propgridpagestate.cpp @@ -1029,6 +1029,8 @@ void wxPropertyGridPageState::CheckColumnWidths( int widthChange ) // Then mode-based requirement if ( !pg->HasVirtualWidth() ) { + m_width = clientWidth; + int widthHigher = m_width - colsWidth; // Adapt colsWidth to width @@ -1167,10 +1169,9 @@ void wxPropertyGridPageState::SetColumnCount( int colCount ) m_colWidths.resize(colCount, wxPG_DRAG_MARGIN); m_columnProportions.resize(colCount, 1); + CheckColumnWidths(); if ( IsDisplayed() ) m_pPropGrid->RecalculateVirtualSize(); - else - CheckColumnWidths(); } void wxPropertyGridPageState::DoSetColumnProportion( unsigned int column,