]> git.saurik.com Git - wxWidgets.git/commitdiff
report Unicode characters when reporting EVT_CHAR in keyboard sample
authorVáclav Slavík <vslavik@fastmail.fm>
Mon, 28 Apr 2008 11:09:20 +0000 (11:09 +0000)
committerVáclav Slavík <vslavik@fastmail.fm>
Mon, 28 Apr 2008 11:09:20 +0000 (11:09 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@53394 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

samples/keyboard/keyboard.cpp

index 5761792e189054a012f0be8502784efbd4c13573..f508378acc6bbff09df6471498e2e2bca17b824f 100644 (file)
@@ -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
             {