in a wx.App i use some frames (that i derived from wx.Frame and that 'know'
the application).
I want to handle all key events (or at least a large selection) globally.
As the single frames 'know' the application they stem from it is no problem
to forward events from all frames to the application.
But all the focus handling and existing bindings are quite a problem,
it is not sufficient to bind wx.EVT_CHAR to the frame, a panel in there
or any other container.
The frames i use contain other controls, buttons, sliders, radio buttons,
but mostly no TextCtrls.
Can anybody give me some hint on how to handle _all_ keys globally within
the application?
Or else, how is global key handling like Ctrl-Q => Quit, Ctrl-S => Save, ...
possible?
One more question, what is the preferred method to detect Ctrl-Key?
event.GetKeyCode() returns a 0x01 for Ctrl-A but there is no constant
defined for that.
in a wx.App i use some frames (that i derived from wx.Frame and that 'know'
the application).
I want to handle all key events (or at least a large selection) globally.
As the single frames 'know' the application they stem from it is no problem
to forward events from all frames to the application.
But all the focus handling and existing bindings are quite a problem,
it is not sufficient to bind wx.EVT_CHAR to the frame, a panel in there
or any other container.
The frames i use contain other controls, buttons, sliders, radio buttons,
but mostly no TextCtrls.
Can anybody give me some hint on how to handle _all_ keys globally within
the application?
Or else, how is global key handling like Ctrl-Q => Quit, Ctrl-S => Save, ...
possible?
Look at the AcceleratorTable class.
One more question, what is the preferred method to detect Ctrl-Key?
event.GetKeyCode() returns a 0x01 for Ctrl-A but there is no constant
defined for that.
AFAIK, in wxPython, differently from Visual Basic, wx.Frame and wx.Panel DO NOT handle key events, and the same applies to all other widgets except wx.TextCtrl (surely) and wx.ComboBox (probably). A sure way I know to globally handle Ctrl-Q => Quit, Ctrl-S => Save and so forth isto combine menus and accelerators.