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) [backport from HEAD]
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/WX_2_8_BRANCH@44668 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -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;
|
||||
|
Reference in New Issue
Block a user