Fix the issue with the grid cell editor special chars handling

Some of the grid cell editors (all of them not based on wxTextCtrl
basically, i.e. wxGridCellBoolEditor, wxGridCellChoiceEditor,
wxGridCellEnumEditor) didn't process Esc, Enter and Tab under MSW,
making them inconvenient to use.

Fix this by adding wxWANTS_CHARS style flag to ensure the editors do get
these keys.

Closes https://github.com/wxWidgets/wxWidgets/pull/1598
This commit is contained in:
Ilya Sinitsyn
2019-10-09 21:14:43 +07:00
committed by Vadim Zeitlin
parent 19c6e004ce
commit 86f14a033c

View File

@@ -6996,12 +6996,22 @@ void wxGrid::ShowCellEditControl()
editor->Create(gridWindow, wxID_ANY,
new wxGridCellEditorEvtHandler(this, editor));
// Ensure the editor window has wxWANTS_CHARS flag, so that it
// gets Tab, Enter and Esc keys, which need to be processed
// specially by wxGridCellEditorEvtHandler.
wxWindow* const editorWindow = editor->GetWindow();
if ( editorWindow )
{
editorWindow->SetWindowStyle(editorWindow->GetWindowStyle()
| wxWANTS_CHARS);
}
wxGridEditorCreatedEvent evt(GetId(),
wxEVT_GRID_EDITOR_CREATED,
this,
row,
col,
editor->GetWindow());
editorWindow);
GetEventHandler()->ProcessEvent(evt);
}
else if ( editor->GetWindow() &&