"Octavian Rasnita" <orasn...@gmail.com> writes: > Please tell me how to get the ID of the command that should execute a > certain function. > I've seen only examples when Escape is used for closing a window, but > I need it for executing a certain function.
Something like this: use constant MENU_FILESTOP => Wx::NewID(); ... $self->{FileMenu}->Append(MENU_FILESTOP, t("S&top\tEsc")); ... my $accelerator = Wx::AcceleratorTable->new ([wxACCEL_NORMAL, WXK_ESCAPE, MENU_FILESTOP]); $self->SetAcceleratorTable( $accelerator ); HTH, Johan Thanks but it still doesn't work. I have tried: use constant MENU_FILESTOP => Wx::NewId(); $self->{FileStop} = $self->{FileMenu}->Append(MENU_FILESTOP, t("S&top\tEsc")); # The previous method was OK since MENU_FILESTOP == $self->{FileStop}->GetId() die if $self->{FileStop}->GetId() != MENU_FILESTOP; my $accelerator = Wx::AcceleratorTable->new([wxACCEL_NORMAL, WXK_ESCAPE, MENU_FILESTOP]); $self->SetAcceleratorTable( $accelerator ); EVT_MENU($self, MENU_FILESTOP, \&Stop); The accelerator works with this method and with the method I had previously used, but only if I change the hotkey with something that doesn't use the Escape key. It works if I use: my $accelerator = Wx::AcceleratorTable->new([wxACCEL_CTRL, ord('Q'), MENU_FILESTOP]); or even my $accelerator = Wx::AcceleratorTable->new([wxACCEL_NORMAL, ord('Q'), $self->{FileStop}->GetId()]); But any combination that uses the Escape key... doesn't work. Is the Escape key broken in WxPerl for Windows? Thanks. Octavian