From 88f67c2242209b8a752b515fdec30fd6ef858a18 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Wed, 7 Mar 2007 23:40:22 +0000 Subject: [PATCH] test for special keys first, before testing for alphanumeric ones as even keys such as WXK_F2 can be recognized as alnum in some locales, in ToString() (modified patch 1669197; bug 1620758) git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@44667 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/common/menucmn.cpp | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/src/common/menucmn.cpp b/src/common/menucmn.cpp index 49f3a00d9e..87969e0411 100644 --- a/src/common/menucmn.cpp +++ b/src/common/menucmn.cpp @@ -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; -- 2.45.2