From: John L. <jla...@gm...> - 2012-06-21 02:31:22
|
On Wed, Jun 20, 2012 at 8:48 AM, Andre Arpin <ar...@ki...> wrote: > Milind Gupta <milind.gupta@...> writes: >> >> Thanks John for the quick reply. I changed the connect statement to : >> >> frame:Connect(ID_FRAME, wx.wxEVT_CHAR_HOOK, CharKeyEvent) >> >> That seems to be catching all keys except the alphabets and numbers. How do I > catch those? Also how do I catch key combinations like Ctrl-X? >> > Try this > --------------------- > frame = wx.wxFrame( wx.NULL, wx.wxID_ANY, "Testing") > frame:Show(true) > frame:Connect(wx.wxID_ANY, wx.wxEVT_CHAR, > function(event) > print(event, event.KeyCode) > end) Getting key events for a frame does not work in Linux, but you can on a child panel (which you should always have in any case). To check for Ctrl/Alt/Shift use wxKeyBoardEvent:Alt/Ctrl/ShiftDown(). Milind, perhaps you're looking for a wxAccelerator or even a menu item with the accelerator attached, "E&xit\tCtrl-X" ? Regards, John |