From b7fff980e73fcb74228d6fc451b1d2eace94fa0d Mon Sep 17 00:00:00 2001 From: Robin Dunn Date: Wed, 16 Feb 2000 20:42:43 +0000 Subject: [PATCH] disable edit control before insert/delete row/col git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@6091 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/generic/grid.cpp | 64 +++++++++++++++++++++++--------------------- 1 file changed, 33 insertions(+), 31 deletions(-) diff --git a/src/generic/grid.cpp b/src/generic/grid.cpp index 0037328fa8..d7c6bf2daa 100644 --- a/src/generic/grid.cpp +++ b/src/generic/grid.cpp @@ -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; } -- 2.47.2