]> git.saurik.com Git - wxWidgets.git/commitdiff
Do use IsEscapeKey() in wxDialog escape key handling.
authorVadim Zeitlin <vadim@wxwidgets.org>
Wed, 3 Oct 2012 08:32:49 +0000 (08:32 +0000)
committerVadim Zeitlin <vadim@wxwidgets.org>
Wed, 3 Oct 2012 08:32:49 +0000 (08:32 +0000)
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

src/common/dlgcmn.cpp

index d95dafd786f832ecaee0351a8096f8840e7a2c0e..5cbbc7e390ba3c85899705ddd54716c17abbf5ec 100644 (file)
@@ -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() )
         {