Add wxGrid::DoEnableCellEditControl() with bool return value

Checking the new function return value is simpler than checking the
value of m_cellEditCtrlEnabled after calling EnableCellEditControl().

Do this now also when starting editing using the mouse, as it was simply
forgotten before and so StartingClick() was still called even if editing
was vetoed.

Also add DoDisableCellEditControl(), but this one exists purely for the
symmetry.
This commit is contained in:
Vadim Zeitlin
2020-06-28 01:47:06 +02:00
parent 2d9112bd9b
commit a400a380f2
2 changed files with 35 additions and 19 deletions

View File

@@ -2912,6 +2912,14 @@ private:
void DoShowCellEditControl();
void DoHideCellEditControl();
// Unconditionally try showing the editor for the current cell.
//
// Returns false if the user code vetoed wxEVT_GRID_EDITOR_SHOWN.
bool DoEnableCellEditControl();
// Unconditionally disable (accepting the changes) the editor.
void DoDisableCellEditControl();
// Accept the changes in the edit control, i.e. save them to the table and
// dismiss the editor. Also reset m_cellEditCtrlEnabled.
void DoAcceptCellEditControl();