From c5cf25e9dfdb7755ce1eed1abbcbe22005b18ccc Mon Sep 17 00:00:00 2001 From: Artur Wieczorek Date: Fri, 14 Jun 2019 21:42:10 +0200 Subject: [PATCH] Fix resizing wxPropertyGrid columns when virtual width is enabled Columns should be resized the same way whether virtual width is enabled or disabled. --- src/propgrid/propgridpagestate.cpp | 35 +++++++++--------------------- 1 file changed, 10 insertions(+), 25 deletions(-) diff --git a/src/propgrid/propgridpagestate.cpp b/src/propgrid/propgridpagestate.cpp index a5b6fb583b..c79472b299 100644 --- a/src/propgrid/propgridpagestate.cpp +++ b/src/propgrid/propgridpagestate.cpp @@ -897,34 +897,19 @@ void wxPropertyGridPageState::DoSetSplitterPosition( int newXPos, int splitterColumn, int flags ) { - wxPropertyGrid* pg = GetGrid(); - int adjust = newXPos - DoGetSplitterPosition(splitterColumn); - - if ( !pg->HasVirtualWidth() ) - { - // No virtual width - int otherColumn; - if ( adjust > 0 ) - { - otherColumn = splitterColumn + 1; - if ( otherColumn == (int)m_colWidths.size() ) - otherColumn = 0; - m_colWidths[splitterColumn] += adjust; - PropagateColSizeDec( otherColumn, adjust, 1 ); - } - else if ( adjust < 0 ) - { - otherColumn = splitterColumn + 1; - if ( otherColumn == (int)m_colWidths.size() ) - otherColumn = 0; - m_colWidths[otherColumn] -= adjust; - PropagateColSizeDec( splitterColumn, -adjust, -1 ); - } - } - else + int otherColumn = splitterColumn + 1; + if ( otherColumn == (int)m_colWidths.size() ) + otherColumn = 0; + if ( adjust > 0 ) { m_colWidths[splitterColumn] += adjust; + PropagateColSizeDec( otherColumn, adjust, 1 ); + } + else if ( adjust < 0 ) + { + m_colWidths[otherColumn] -= adjust; + PropagateColSizeDec( splitterColumn, -adjust, -1 ); } // Actual adjustment can be different from demanded. newXPos = DoGetSplitterPosition(splitterColumn);