develooper Front page | perl.wxperl.users | Postings from June 2008

Re: Using the Escape Key to exit the wxPerl application

Thread Previous | Thread Next
From:
bungsuputra linan
Date:
June 17, 2008 10:06
Subject:
Re: Using the Escape Key to exit the wxPerl application
Message ID:
1213719302.6688.1.camel@intel-dp35dp

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,
bungsu





Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About