Add DoShowCellEditControl() showing the editor unconditionally

It doesn't make sense to perform the checks in ShowCellEditControl()
when it's called from EnableCellEditControl() and this makes the code
unnecessarily fragile as m_cellEditCtrlEnabled needs to be set at just
the right moment for it to work correctly.

Call the new DoShowCellEditControl() instead and perform the checks only
in the public function, for compatibility.

Also note in a comment and the documentation that ShowCellEditControl()
is not very useful anyhow and that EnableCellEditControl() should most
often be used instead.

No real changes (the commit is best viewed ignoring whitespace changes).
This commit is contained in:
Vadim Zeitlin
2020-06-28 00:28:51 +02:00
parent 181747f462
commit c73634c520
3 changed files with 130 additions and 124 deletions

View File

@@ -1509,7 +1509,7 @@ public:
bool IsCurrentCellReadOnly() const;
void ShowCellEditControl();
void ShowCellEditControl(); // Use EnableCellEditControl() instead.
void HideCellEditControl();
void SaveEditControlValue();
@@ -2908,6 +2908,9 @@ private:
);
}
// Show the cell editor for the current cell unconditionally.
void DoShowCellEditControl();
// Accept the changes in the edit control, i.e. save them to the table and
// dismiss the editor.
void DoAcceptCellEditControl();