]> git.saurik.com Git - wxWidgets.git/commitdiff
disable edit control before insert/delete row/col
authorRobin Dunn <robin@alldunn.com>
Wed, 16 Feb 2000 20:42:43 +0000 (20:42 +0000)
committerRobin Dunn <robin@alldunn.com>
Wed, 16 Feb 2000 20:42:43 +0000 (20:42 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@6091 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

src/generic/grid.cpp

index 0037328fa82d33ea6ab65c05cfa12ae0798b3150..d7c6bf2daadbd354adf80b64a7914c4cc10c45b9 100644 (file)
@@ -3240,6 +3240,9 @@ bool wxGrid::InsertRows( int pos, int numRows, bool WXUNUSED(updateLabels) )
 
     if ( m_table )
     {
+        if (IsCellEditControlEnabled())
+            EnableCellEditControl(FALSE);
+
         bool ok = m_table->InsertRows( pos, numRows );
 
         // the table will have sent the results of the insert row
@@ -3322,24 +3325,23 @@ bool wxGrid::DeleteRows( int pos, int numRows, bool WXUNUSED(updateLabels) )
         return FALSE;
     }
 
-    if ( m_table && m_table->DeleteRows( pos, numRows ) )
+    if ( m_table )
     {
-        // the table will have sent the results of the delete row
-        // operation to this view object as a grid table message
-        //
-        if ( m_numRows > 0 )
-            SetEditControlValue();
-        else
-            HideCellEditControl();
+        if (IsCellEditControlEnabled())
+            EnableCellEditControl(FALSE);
 
-        ClearSelection();
-        if ( !GetBatchCount() ) Refresh();
-        return TRUE;
-    }
-    else
-    {
-        return FALSE;
+        if (m_table->DeleteRows( pos, numRows ))
+        {
+
+            // the table will have sent the results of the delete row
+            // operation to this view object as a grid table message
+            //
+            ClearSelection();
+            if ( !GetBatchCount() ) Refresh();
+            return TRUE;
+        }
     }
+    return FALSE;
 }
 
 
@@ -3355,7 +3357,9 @@ bool wxGrid::InsertCols( int pos, int numCols, bool WXUNUSED(updateLabels) )
 
     if ( m_table )
     {
-        HideCellEditControl();
+        if (IsCellEditControlEnabled())
+            EnableCellEditControl(FALSE);
+
         bool ok = m_table->InsertCols( pos, numCols );
 
         // the table will have sent the results of the insert col
@@ -3429,24 +3433,22 @@ bool wxGrid::DeleteCols( int pos, int numCols, bool WXUNUSED(updateLabels) )
         return FALSE;
     }
 
-    if ( m_table && m_table->DeleteCols( pos, numCols ) )
+    if ( m_table )
     {
-        // the table will have sent the results of the delete col
-        // operation to this view object as a grid table message
-        //
-        if ( m_numCols > 0 )
-            SetEditControlValue();
-        else
-            HideCellEditControl();
+        if (IsCellEditControlEnabled())
+            EnableCellEditControl(FALSE);
 
-        ClearSelection();
-        if ( !GetBatchCount() ) Refresh();
-        return TRUE;
-    }
-    else
-    {
-        return FALSE;
+        if ( m_table->DeleteCols( pos, numCols ) )
+        {
+            // the table will have sent the results of the delete col
+            // operation to this view object as a grid table message
+            //
+            ClearSelection();
+            if ( !GetBatchCount() ) Refresh();
+            return TRUE;
+        }
     }
+    return FALSE;
 }