On Tue, 2008-06-17 at 16:57 +1000, James McDonald wrote: > I would like to close my application by pressing the escape key. > > I know I have to define the escape key press event and specify a sub > routine that will trigger when I press escape. However I haven't been > able to google an example. > > Could anyone point me in the right direction? > If it's a Wx::Dialog, you could put a button on the dialog with id wxID_CANCEL. For example: my $btn = Wx::Button->new($this, wxID_CANCEL, 'Cancel', wxDefaultPosition, wxDefaultSize, 0); Everytime you press the escape key, the dialog will be closed. I hope it helps. Regards, bungsuThread Previous | Thread Next