Stop editing in generic wxDataViewCtrl when any button is pressed

Previously, the editor was hidden if the left mouse button was pressed,
but not for the right (or any other) button, which could result in a
confusing situation when a user could select a command from a context
menu shown from the corresponding event handler and start editing
another item while the current one was still being edited too.
This commit is contained in:
Vadim Zeitlin 2018-12-06 22:53:28 +01:00
parent 2d18aaf58a
commit da612f02b5

View File

@ -4558,6 +4558,12 @@ void wxDataViewMainWindow::OnMouse( wxMouseEvent &event )
// setting focus to this window as most (all?) of them do by default,
// so skip it to enable default handling.
event.Skip();
// Also stop editing if any mouse button is pressed: this is not really
// necessary for the left button, as it would result in a focus loss
// that would make the editor close anyhow, but we do need to do it for
// the other ones and it does no harm to do it for the left one too.
FinishEditing();
}
// Handle right clicking here, before everything else as context menu