Johan Vromans wrote:
Hi,
How can I close a Wx window with Ctrl-W (or Alt-F4 or something similar)?
Shortcuts seem only to work with menus and buttons.
I am not sure if you already tried this, however:
$self->SetAcceleratorTable
( Wx::AcceleratorTable->new
( [ wxACCEL_CTRL, 'W', wxID_CLOSE ],
[ wxACCEL_ALT, 'W', <some id> ],
...
);
EVT_MENU( $self, <some id>, sub { <close window> } );
Should work. You can use accelerators with both existing
menu items/event and "fictional" ones that only exixt to be
used by the accelerator.
HTH
Mattia