From: "Johan Vromans" <jvrom...@squirrel.nl>
"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.
Aha, I understand. I thought that the third item must be the ID of the menu
item.
(But I think the ID of the menu item is returned by the Append() method,
because I can use that value when defining events for it.)
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.
Thanks.
Octavian