X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/7db509e27e4478251a9947a2c0d25f2188212806..b4eecebd423df0c6efe86d7658cd3df818d67ed8:/wxPython/demo/KeyEvents.py diff --git a/wxPython/demo/KeyEvents.py b/wxPython/demo/KeyEvents.py index 2c72a3a911..b0ef7589c3 100644 --- a/wxPython/demo/KeyEvents.py +++ b/wxPython/demo/KeyEvents.py @@ -23,8 +23,8 @@ keyMap = { wx.WXK_MENU : "WXK_MENU", wx.WXK_PAUSE : "WXK_PAUSE", wx.WXK_CAPITAL : "WXK_CAPITAL", - wx.WXK_PRIOR : "WXK_PRIOR", - wx.WXK_NEXT : "WXK_NEXT", + #wx.WXK_PRIOR : "WXK_PRIOR", + #wx.WXK_NEXT : "WXK_NEXT", wx.WXK_END : "WXK_END", wx.WXK_HOME : "WXK_HOME", wx.WXK_LEFT : "WXK_LEFT", @@ -93,9 +93,9 @@ keyMap = { wx.WXK_NUMPAD_UP : "WXK_NUMPAD_UP", wx.WXK_NUMPAD_RIGHT : "WXK_NUMPAD_RIGHT", wx.WXK_NUMPAD_DOWN : "WXK_NUMPAD_DOWN", - wx.WXK_NUMPAD_PRIOR : "WXK_NUMPAD_PRIOR", + #wx.WXK_NUMPAD_PRIOR : "WXK_NUMPAD_PRIOR", wx.WXK_NUMPAD_PAGEUP : "WXK_NUMPAD_PAGEUP", - wx.WXK_NUMPAD_NEXT : "WXK_NUMPAD_NEXT", + #wx.WXK_NUMPAD_NEXT : "WXK_NUMPAD_NEXT", wx.WXK_NUMPAD_PAGEDOWN : "WXK_NUMPAD_PAGEDOWN", wx.WXK_NUMPAD_END : "WXK_NUMPAD_END", wx.WXK_NUMPAD_BEGIN : "WXK_NUMPAD_BEGIN", @@ -122,7 +122,7 @@ class KeySink(wx.Window): self.SetBackgroundColour(wx.BLUE) self.haveFocus = False - self.callSkip = False + self.callSkip = True self.logKeyDn = True self.logKeyUp = True self.logChar = True @@ -226,8 +226,13 @@ class KeyLog(wx.ListCtrl, listmix.ListCtrlAutoWidthMixin): keycode = evt.GetKeyCode() keyname = keyMap.get(keycode, None) if keyname is None: - if "unicode" in wx.PlatformInfo and keycode < 128: + if "unicode" in wx.PlatformInfo: + keycode = evt.GetUnicodeKey() + if keycode <= 127: + keycode = evt.GetKeyCode() keyname = "\"" + unichr(evt.GetUnicodeKey()) + "\"" + if keycode < 27: + keyname = "Ctrl-%s" % chr(ord('A') + keycode-1) elif keycode < 256: if keycode == 0: @@ -315,6 +320,7 @@ class TestPanel(wx.Panel): cb1 = wx.CheckBox(self, -1, "Call evt.Skip in Key* events") self.Bind(wx.EVT_CHECKBOX, self.OnSkipCB, cb1) + cb1.SetValue(True) cb2 = wx.CheckBox(self, -1, "KEY_UP") self.Bind(wx.EVT_CHECKBOX, self.OnKeyUpCB, cb2)