How to catch Hotkeys ?

Hello !

I want to use HotKeys in wxFrame - for Buttons.

In Delphi I simply do that:
When I use Caption with & sign, it is used as HotKey.

Example:
- btn=TButton.Create(Self);
  btn.Caption:='&Load';

  // The btn is activatable with click, and with Alt+L.

Another way to set mainform's keypreview to True, and
write the OnKeyDown event handler.

I want to same thing in wxFrame.

Is possible ?

Thanx for every help.

···

--
Üdv/Kind of Regards:
fowlertrainer@anonym.hu
mailto:fowlertrainer@anonym.hu

fowlertrainer@anonym.hu wrote:

Hello !

I want to use HotKeys in wxFrame - for Buttons.

In Delphi I simply do that:
When I use Caption with & sign, it is used as HotKey.

Example:
- btn=TButton.Create(Self);
  btn.Caption:='&Load';

  // The btn is activatable with click, and with Alt+L.

Another way to set mainform's keypreview to True, and
write the OnKeyDown event handler.

I want to same thing in wxFrame.

Is possible ?

Key/char events are only sent to the widget that has the focus. If you want to catch hotkeys no matter where the focus is within a frame then use an accelerator table and catch the events with EVT_MENU.

···

--
Robin Dunn
Software Craftsman
http://wxPython.org Java give you jitters? Relax with wxPython!