"Octavian Rasnita" <orasn...@gmail.com> writes: > Hi, > > I have tried to define an accelerator for a button, then I've seen that the > accelerator for menu items work on more platforms so I've tried to define an > accelerator for a menu item, but it still doesn't work. > > I've defined the menu item: > > $self->{FileStop} = $self->{FileMenu}->Append(-1, t("S&top\tEsc")); > > #... then the accelerator: > my $accelerator = Wx::AcceleratorTable->new > ([wxACCEL_NORMAL, WXK_ESCAPE, $self->{FileStop}]); > $self->SetAcceleratorTable( $accelerator );
The 3rd arg needs to be a command id. $self->{FileStop} contains the boolean result from appending the menu item. E.g. ([wxACCEL_NORMAL, WXK_ESCAPE, wxID_CLOSE); HTH, -- Johan