Add DoHideCellEditControl() for symmetry
This also allows to reset m_cellEditCtrlEnabled earlier, as we don't have to keep it true for the duration of HideCellEditControl() execution. No real changes, as with the previous commit, this one is best viewed ignoring whitespace changes.
This commit is contained in:
@@ -2908,11 +2908,12 @@ private:
|
||||
);
|
||||
}
|
||||
|
||||
// Show the cell editor for the current cell unconditionally.
|
||||
// Show/hide the cell editor for the current cell unconditionally.
|
||||
void DoShowCellEditControl();
|
||||
void DoHideCellEditControl();
|
||||
|
||||
// Accept the changes in the edit control, i.e. save them to the table and
|
||||
// dismiss the editor.
|
||||
// dismiss the editor. Also reset m_cellEditCtrlEnabled.
|
||||
void DoAcceptCellEditControl();
|
||||
|
||||
// As above, but do nothing if the control is not currently shown.
|
||||
|
@@ -7343,6 +7343,12 @@ void wxGrid::DoShowCellEditControl()
|
||||
void wxGrid::HideCellEditControl()
|
||||
{
|
||||
if ( IsCellEditControlEnabled() )
|
||||
{
|
||||
DoHideCellEditControl();
|
||||
}
|
||||
}
|
||||
|
||||
void wxGrid::DoHideCellEditControl()
|
||||
{
|
||||
wxGridCellEditorPtr editor = GetCurrentCellEditorPtr();
|
||||
const bool editorHadFocus = editor->GetWindow()->IsDescendant(FindFocus());
|
||||
@@ -7388,7 +7394,6 @@ void wxGrid::HideCellEditControl()
|
||||
rightGridWindow->Refresh( false, &rect );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void wxGrid::AcceptCellEditControlIfShown()
|
||||
{
|
||||
@@ -7400,15 +7405,13 @@ void wxGrid::AcceptCellEditControlIfShown()
|
||||
|
||||
void wxGrid::DoAcceptCellEditControl()
|
||||
{
|
||||
HideCellEditControl();
|
||||
|
||||
// do it after HideCellEditControl() but before invoking
|
||||
// user-defined handlers invoked by DoSaveEditControlValue() to
|
||||
// ensure that we don't enter infinite loop if any of them try to
|
||||
// disable the edit control again by calling DisableCellEditControl()
|
||||
// from which we can be called
|
||||
// Reset it first to avoid any problems with recursion via
|
||||
// DisableCellEditControl() if it's called from the user-defined event
|
||||
// handlers.
|
||||
m_cellEditCtrlEnabled = false;
|
||||
|
||||
DoHideCellEditControl();
|
||||
|
||||
DoSaveEditControlValue();
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user