Catch all key events in frame?

Hi.

How do I best capture all key events in a frame. Specifically: In
Albuin I
want to delete selected songs in the playlist when the user presses
‘del’ -
no matter what control in the frame happens to be in focused atm. What
event
should I bind to and to which control?

(as a side note, the latest svn of albuin fixed the alexs’ problem with
sequel-2.x - never, ever, use depreched methods… :slight_smile:

Thanks,
Albin Holmgren

Hi Albin

Albin Holmgren wrote:

How do I best capture all key events in a frame. Specifically: In
Albuin I want to delete selected songs in the playlist when the user
presses ‘del’ - no matter what control in the frame happens to be in
focused atm. What event should I bind to and to which control?
For that sort of thing you could use an accelerator table, which creates
keyboard shortcuts for menu items. This example makes the ‘backspace’
key a shortcut for the Wx::ID_EXIT menu item (assuming self is a
Wx::Frame)

tbl = Wx::AcceleratorTable.new [Wx::ACCEL_NORMAL, Wx::K_BACK,

Wx::ID_EXIT ]
self.accelerator_table = tbl

The code for del is Wx::K_DEL. As an aside, Mac laptops don’t generally
have a ‘del’ key so it may not be the best choice for a shortcut.

(as a side note, the latest svn of albuin fixed the alexs’ problem
with sequel-2.x - never, ever, use depreched methods… :slight_smile:
Thanks; I’ll give it a whirl when I get a moment.

alex