]> git.saurik.com Git - wxWidgets.git/commitdiff
test for special keys first, before testing for alphanumeric ones as even keys such...
authorVadim Zeitlin <vadim@wxwidgets.org>
Wed, 7 Mar 2007 23:40:22 +0000 (23:40 +0000)
committerVadim Zeitlin <vadim@wxwidgets.org>
Wed, 7 Mar 2007 23:40:22 +0000 (23:40 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@44667 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

src/common/menucmn.cpp

index 49f3a00d9e08b8f9deef1edbf56b38949f59a60e..87969e0411da4450b8d2623b22dabae99dfa0de7 100644 (file)
@@ -319,9 +319,7 @@ wxString wxAcceleratorEntry::ToString() const
 
     const int code = GetKeyCode();
 
-    if ( wxIsalnum(code) )
-        text << (wxChar)code;
-    else if ( code >= WXK_F1 && code <= WXK_F12 )
+    if ( code >= WXK_F1 && code <= WXK_F12 )
         text << _("F") << code - WXK_F1 + 1;
     else if ( code >= WXK_NUMPAD0 && code <= WXK_NUMPAD9 )
         text << _("KP_") << code - WXK_NUMPAD0;
@@ -340,8 +338,22 @@ wxString wxAcceleratorEntry::ToString() const
             }
         }
 
-        wxASSERT_MSG( n != WXSIZEOF(wxKeyNames),
-                      wxT("unknown keyboard accelerator code") );
+        if ( n == WXSIZEOF(wxKeyNames) )
+        {
+            // must be a simple key
+            if (
+#if !wxUSE_UNICODE
+                 isascii(code) &&
+#endif // ANSI
+                    wxIsalnum(code) )
+            {
+                text << (wxChar)code;
+            }
+            else
+            {
+                wxFAIL_MSG( wxT("unknown keyboard accelerator code") );
+            }
+        }
     }
 
     return text;