X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/3d184f1e60e6dcdd05d7ef5a8a7eb8c17f9fef22..a2d65663a0e7e5d4633119bf469fe66d8a8897c5:/src/generic/grid.cpp diff --git a/src/generic/grid.cpp b/src/generic/grid.cpp index 4926ae4a99..751dc61143 100644 --- a/src/generic/grid.cpp +++ b/src/generic/grid.cpp @@ -2945,8 +2945,6 @@ bool wxGrid::Redimension( wxGridTableMessage& msg ) int numCols = msg.GetCommandInt(); int oldNumCols = m_numCols; m_numCols += numCols; - if ( m_useNativeHeader ) - GetGridColHeader()->SetColumnCount(m_numCols); if ( !m_colAt.IsEmpty() ) { @@ -2978,6 +2976,12 @@ bool wxGrid::Redimension( wxGridTableMessage& msg ) } } + // Notice that this must be called after updating m_colWidths above + // as the native grid control will check whether the new columns + // are shown which results in accessing m_colWidths array. + if ( m_useNativeHeader ) + GetGridColHeader()->SetColumnCount(m_numCols); + if ( m_currentCellCoords == wxGridNoCellCoords ) { // if we have just inserted cols into an empty grid the current