Remove check for read only cells from IsCellEditControlEnabled()

This check was introduced back in 283b7808d8 (added support for readonly
cells and 3d border drawing, 2000-02-16), but was wrong even then and
remained wrong ever since: we must not set m_cellEditCtrlEnabled to true
when the current cell is read-only, so there is no need to check for the
latter condition if m_cellEditCtrlEnabled is indeed true.

Ensure that we really never erroneously set m_cellEditCtrlEnabled for
the read-only cells by replacing an wxASSERT_MSG checking for this in
EnableCellEditControl() with wxCHECK_RET().

Also explicitly document this function precondition, also added back in
b54ba67107 ([...] added CanEnableCellControl() and use it before calling
EnableEC, 2000-02-17) but never documented so far.
This commit is contained in:
Vadim Zeitlin
2020-06-27 23:50:44 +02:00
parent 1a330bb43e
commit 45bc2e648b
3 changed files with 7 additions and 11 deletions

View File

@@ -3440,6 +3440,9 @@ public:
currently show, otherwise the @c wxEVT_GRID_EDITOR_HIDDEN event is
generated but, unlike the "shown" event, it can't be vetoed and the
in-place editor is dismissed unconditionally.
Note that it is an error to call this function if the current cell is
read-only, use CanEnableCellControl() to check for this precondition.
*/
void EnableCellEditControl(bool enable = true);