From: Václav Slavík Date: Mon, 28 Apr 2008 11:09:20 +0000 (+0000) Subject: report Unicode characters when reporting EVT_CHAR in keyboard sample X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/52bbab36a22011d4fcccdcd608fd4a0b933824ea?ds=inline report Unicode characters when reporting EVT_CHAR in keyboard sample git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@53394 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- diff --git a/samples/keyboard/keyboard.cpp b/samples/keyboard/keyboard.cpp index 5761792e18..f508378acc 100644 --- a/samples/keyboard/keyboard.cpp +++ b/samples/keyboard/keyboard.cpp @@ -472,12 +472,24 @@ void TextWindow::LogEvent(const wxChar *name, wxKeyEvent& event) if ( keycode < 256 ) { if ( keycode == 0 ) - key.Printf(_T("NUL")); + { +#if wxUSE_UNICODE + const wxChar u = event.GetUnicodeKey(); + if ( u ) + key.Printf(_T("Unicode char '%c' (U+%04x)"), u, u); + else +#endif + key.Printf(_T("NUL")); + } else if ( keycode < 27 ) + { key.Printf(_T("Ctrl-%c"), (unsigned char)(_T('A') + keycode - 1)); + } else + { key.Printf(_T("'%c'"), (unsigned char)keycode); + } } else {