Do use IsEscapeKey() in wxDialog escape key handling.
This method was added back in r40686 but was never actually used anywhere. Do use it in wxDialogBase::OnCharHook() now instead of hard-coding the check for WXK_ESCAPE, this should allow using Cmd+. to work like Escape under Mac which was apparently the intention of the code in src/osx/dialog_osx.cpp. Also fix IsEscapeKey() itself to ignore any modifiers as at least under MSW Esc always closes the dialog, even if Shift or Alt is pressed. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@72610 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
parent
b785d15d50
commit
f821bc3617
@ -461,14 +461,16 @@ bool wxDialogBase::SendCloseButtonClickEvent()
|
||||
|
||||
bool wxDialogBase::IsEscapeKey(const wxKeyEvent& event)
|
||||
{
|
||||
// for most platforms, Esc key is used to close the dialogs
|
||||
return event.GetKeyCode() == WXK_ESCAPE &&
|
||||
event.GetModifiers() == wxMOD_NONE;
|
||||
// For most platforms, Esc key is used to close the dialogs.
|
||||
//
|
||||
// Notice that we intentionally don't check for modifiers here, Shift-Esc,
|
||||
// Alt-Esc and so on still close the dialog, typically.
|
||||
return event.GetKeyCode() == WXK_ESCAPE;
|
||||
}
|
||||
|
||||
void wxDialogBase::OnCharHook(wxKeyEvent& event)
|
||||
{
|
||||
if ( event.GetKeyCode() == WXK_ESCAPE )
|
||||
if ( IsEscapeKey(event) )
|
||||
{
|
||||
if ( SendCloseButtonClickEvent() )
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user