AcceleratorTable

Hi all,

i’m using Wx::AcceleratorTable to shortcut function keys (F1, F2…)

Given the code:

acc_table = Wx::AcceleratorTable[
[ Wx::MOD_NORMAL, Wx::K_F3, myBtn.get_id() ],
[ Wx::MOD_ALT, Wx::K_F4, myMnu.get_id() ]…]
frame.accelerator_table = acc_table

the 3° param of Wx:AcceleratorEntry is an id identifing a menu item id
or a
commad id.

If i have a menu item or a button, i get the corresponding id into the
third
param and everything works as expected.

What to do if i have just a function (no button, neither menu item
binded)?

How do i get the id to bind to?

Any help is greately appreciated.

thank you.

bio.

hi Fabio

Fabio P. wrote:

i’m using Wx::AcceleratorTable to shortcut function keys (F1, F2…)

What to do if i have just a function (no button, neither menu item
binded)?

An Accelerator Table is just that - a mapping of key presses that
provide fast access to existing menu items or GUI controls. So it’s
expected that there should be an ID to go with each.

However I expect that an accelerator entry would trigger an evt_menu
even if there wasn’t actually a real menu item in the Frame’s menus, if
you wanted to “cheat”:

evt_menu(SOME_ARBITRARY_ID, :the_function)
AcceleratorTable(…)

alex

Thank you Alex,

However I expect that an accelerator entry would trigger an evt_menu
even if

there wasn’t actually a real menu item in the Frame’s menus, if you wanted
to “cheat”:

evt_menu(SOME_ARBITRARY_ID, :the_function)
AcceleratorTable(…)

i’ll try to use your tip.

cheers.

bio.