]> git.saurik.com Git - wxWidgets.git/blobdiff - src/generic/grid.cpp
preserve checkbox status in SetString()
[wxWidgets.git] / src / generic / grid.cpp
index 4926ae4a992c0d782e1877bef711475ca36198d3..751dc611433d4da5c53c64173b78e1035af5f5cc 100644 (file)
@@ -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