Update all controls using in-place editors to handle Escape/Return correctly.
Define EVT_CHAR_HOOK handlers to ensure that pressing Escape/Return while an in-place edit control is active affects only it and is not used for the keyboard navigation. Closes #9102. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@69897 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -228,6 +228,7 @@ public:
|
||||
|
||||
BEGIN_EVENT_TABLE(wxListCtrl, wxControl)
|
||||
EVT_PAINT(wxListCtrl::OnPaint)
|
||||
EVT_CHAR_HOOK(wxListCtrl::OnCharHook)
|
||||
END_EVENT_TABLE()
|
||||
|
||||
// ============================================================================
|
||||
@@ -2973,6 +2974,27 @@ void wxListCtrl::OnPaint(wxPaintEvent& event)
|
||||
}
|
||||
}
|
||||
|
||||
void wxListCtrl::OnCharHook(wxKeyEvent& event)
|
||||
{
|
||||
if ( GetEditControl() )
|
||||
{
|
||||
// We need to ensure that Escape is not stolen from the in-place editor
|
||||
// by the containing dialog.
|
||||
//
|
||||
// Notice that we don't have to care about Enter key here as we return
|
||||
// false from MSWShouldPreProcessMessage() for it.
|
||||
if ( event.GetKeyCode() == WXK_ESCAPE )
|
||||
{
|
||||
EndEditLabel(true /* cancel */);
|
||||
|
||||
// Don't call Skip() below.
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
event.Skip();
|
||||
}
|
||||
|
||||
WXLRESULT
|
||||
wxListCtrl::MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam)
|
||||
{
|
||||
|
Reference in New Issue
Block a user