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
This commit is contained in:
Robin Dunn
2000-02-16 20:42:43 +00:00
parent d73dd2b2fc
commit b7fff980e7

View File

@@ -3240,6 +3240,9 @@ bool wxGrid::InsertRows( int pos, int numRows, bool WXUNUSED(updateLabels) )
if ( m_table ) if ( m_table )
{ {
if (IsCellEditControlEnabled())
EnableCellEditControl(FALSE);
bool ok = m_table->InsertRows( pos, numRows ); bool ok = m_table->InsertRows( pos, numRows );
// the table will have sent the results of the insert row // 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; return FALSE;
} }
if ( m_table && m_table->DeleteRows( pos, numRows ) ) if ( m_table )
{ {
if (IsCellEditControlEnabled())
EnableCellEditControl(FALSE);
if (m_table->DeleteRows( pos, numRows ))
{
// the table will have sent the results of the delete row // the table will have sent the results of the delete row
// operation to this view object as a grid table message // operation to this view object as a grid table message
// //
if ( m_numRows > 0 )
SetEditControlValue();
else
HideCellEditControl();
ClearSelection(); ClearSelection();
if ( !GetBatchCount() ) Refresh(); if ( !GetBatchCount() ) Refresh();
return TRUE; return TRUE;
} }
else
{
return FALSE;
} }
return FALSE;
} }
@@ -3355,7 +3357,9 @@ bool wxGrid::InsertCols( int pos, int numCols, bool WXUNUSED(updateLabels) )
if ( m_table ) if ( m_table )
{ {
HideCellEditControl(); if (IsCellEditControlEnabled())
EnableCellEditControl(FALSE);
bool ok = m_table->InsertCols( pos, numCols ); bool ok = m_table->InsertCols( pos, numCols );
// the table will have sent the results of the insert col // 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; return FALSE;
} }
if ( m_table && m_table->DeleteCols( pos, numCols ) ) if ( m_table )
{
if (IsCellEditControlEnabled())
EnableCellEditControl(FALSE);
if ( m_table->DeleteCols( pos, numCols ) )
{ {
// the table will have sent the results of the delete col // the table will have sent the results of the delete col
// operation to this view object as a grid table message // operation to this view object as a grid table message
// //
if ( m_numCols > 0 )
SetEditControlValue();
else
HideCellEditControl();
ClearSelection(); ClearSelection();
if ( !GetBatchCount() ) Refresh(); if ( !GetBatchCount() ) Refresh();
return TRUE; return TRUE;
} }
else
{
return FALSE;
} }
return FALSE;
} }