Handle Unicode keys correctly in wxTextValidator.

Don't allow entering arbitrary Unicode keys in wxTextValidator limited to
digits only, for example.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@75451 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin 2013-12-29 00:19:12 +00:00
parent a425e9f70d
commit aff918ab1d

View File

@ -308,10 +308,20 @@ void wxTextValidator::OnChar(wxKeyEvent& event)
return;
}
#if wxUSE_UNICODE
// We only filter normal, printable characters.
int keyCode = event.GetUnicodeKey();
#else // !wxUSE_UNICODE
int keyCode = event.GetKeyCode();
if (keyCode > WXK_START)
{
event.Skip();
return;
}
#endif // wxUSE_UNICODE/!wxUSE_UNICODE
// we don't filter special keys and delete
if (keyCode < WXK_SPACE || keyCode == WXK_DELETE || keyCode >= WXK_START)
if (keyCode < WXK_SPACE || keyCode == WXK_DELETE)
{
event.Skip();
return;