diff --git a/src/generic/grid.cpp b/src/generic/grid.cpp index 450ff9ff7a..98e8e9fe20 100644 --- a/src/generic/grid.cpp +++ b/src/generic/grid.cpp @@ -3473,9 +3473,6 @@ bool wxGrid::Redimension( wxGridTableMessage& msg ) int numCols = msg.GetCommandInt2(); m_numCols += numCols; - if ( m_useNativeHeader ) - GetGridColHeader()->SetColumnCount(m_numCols); - if ( !m_colAt.IsEmpty() ) { //Shift the column IDs @@ -3513,6 +3510,11 @@ bool wxGrid::Redimension( wxGridTableMessage& msg ) } } + // See comment for wxGRIDTABLE_NOTIFY_COLS_APPENDED case explaining + // why this has to be done here and not before. + if ( m_useNativeHeader ) + GetGridColHeader()->SetColumnCount(m_numCols); + UpdateCurrentCellOnRedim(); if ( m_selection ) @@ -3586,8 +3588,6 @@ bool wxGrid::Redimension( wxGridTableMessage& msg ) size_t pos = msg.GetCommandInt(); int numCols = msg.GetCommandInt2(); m_numCols -= numCols; - if ( m_useNativeHeader ) - GetGridColHeader()->SetColumnCount(m_numCols); if ( !m_colAt.IsEmpty() ) { @@ -3620,6 +3620,11 @@ bool wxGrid::Redimension( wxGridTableMessage& msg ) } } + // See comment for wxGRIDTABLE_NOTIFY_COLS_APPENDED case explaining + // why this has to be done here and not before. + if ( m_useNativeHeader ) + GetGridColHeader()->SetColumnCount(m_numCols); + UpdateCurrentCellOnRedim(); if ( m_selection )