I have a wx.TextCtrl and I want to be able to type in it, but also detect key presses such as UP, DOWN, RETURN, ESC.
So I binded wx.EVT_KEY_DOWN to recognize any key press, and wx.EVT_CHAR_HOOK to do the same thing even when TextCtrl has focus.
self.Bind(wx.EVT_KEY_DOWN, self.keyPressed)
self.Bind(wx.EVT_CHAR_HOOK, self.keyPressed)
Key presses UP, DOWN, RETURN, ESC were recognized and working fine, but due to binding EVT_CHAR_HOOK I cannot use LEFT RIGHT BACKSPACE SHIFT anymore when I type in the TextCtrl.
Any suggestions?
You should call
event.Skip()
at the end of the event handler to propagate it further. This works for me: