Improve printing out of pressed keys in the keyboard sample.
Add missing elements of wxKeyCode enum ("Windows" and "Command" keys) to the GetVirtualKeyCodeName() function in the sample. Also output "unknown" and not blank for WXK_NONE. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@65524 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -335,7 +335,12 @@ const char* GetVirtualKeyCodeName(int keycode)
|
|||||||
WXK_(NUMPAD_SUBTRACT)
|
WXK_(NUMPAD_SUBTRACT)
|
||||||
WXK_(NUMPAD_DECIMAL)
|
WXK_(NUMPAD_DECIMAL)
|
||||||
WXK_(NUMPAD_DIVIDE)
|
WXK_(NUMPAD_DIVIDE)
|
||||||
|
|
||||||
|
WXK_(WINDOWS_LEFT)
|
||||||
|
WXK_(WINDOWS_RIGHT)
|
||||||
|
WXK_(COMMAND)
|
||||||
#undef WXK_
|
#undef WXK_
|
||||||
|
|
||||||
default:
|
default:
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
@@ -352,11 +357,14 @@ wxString GetKeyName(const wxKeyEvent &event)
|
|||||||
return wxString::Format("Ctrl-%c", (unsigned char)('A' + keycode - 1));
|
return wxString::Format("Ctrl-%c", (unsigned char)('A' + keycode - 1));
|
||||||
if ( keycode >= 32 && keycode < 128 )
|
if ( keycode >= 32 && keycode < 128 )
|
||||||
return wxString::Format("'%c'", (unsigned char)keycode);
|
return wxString::Format("'%c'", (unsigned char)keycode);
|
||||||
|
|
||||||
#if wxUSE_UNICODE
|
#if wxUSE_UNICODE
|
||||||
return wxString::Format("'%c'", event.GetUnicodeKey());
|
int uc = event.GetUnicodeKey();
|
||||||
#else
|
if ( uc != WXK_NONE )
|
||||||
return "unknown";
|
return wxString::Format("'%c'", uc);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
return "unknown";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user