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
This commit is contained in:
@@ -319,9 +319,7 @@ wxString wxAcceleratorEntry::ToString() const
|
|||||||
|
|
||||||
const int code = GetKeyCode();
|
const int code = GetKeyCode();
|
||||||
|
|
||||||
if ( wxIsalnum(code) )
|
if ( code >= WXK_F1 && code <= WXK_F12 )
|
||||||
text << (wxChar)code;
|
|
||||||
else if ( code >= WXK_F1 && code <= WXK_F12 )
|
|
||||||
text << _("F") << code - WXK_F1 + 1;
|
text << _("F") << code - WXK_F1 + 1;
|
||||||
else if ( code >= WXK_NUMPAD0 && code <= WXK_NUMPAD9 )
|
else if ( code >= WXK_NUMPAD0 && code <= WXK_NUMPAD9 )
|
||||||
text << _("KP_") << code - WXK_NUMPAD0;
|
text << _("KP_") << code - WXK_NUMPAD0;
|
||||||
@@ -340,8 +338,22 @@ wxString wxAcceleratorEntry::ToString() const
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
wxASSERT_MSG( n != WXSIZEOF(wxKeyNames),
|
if ( n == WXSIZEOF(wxKeyNames) )
|
||||||
wxT("unknown keyboard accelerator code") );
|
{
|
||||||
|
// 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;
|
return text;
|
||||||
|
Reference in New Issue
Block a user