X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/add6e9193dfbeec8ad88d4e341bc46165b97e3dd..27d79a5027bee4f46e57c813d072422065cb1592:/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