How to create TMenuItem in FMX with shortcut as number key or +/- key?


I’m trying to replicate something similar to the Inkscape Zoom shortcuts shown below. Note that these Inkscape shortcuts work whether or not the number pad is used.

The first problem is that setting the shortcuts via the Object Inspector isn’t possible, as there are no options for these keys on their own without modifier keys. I then tried setting the shortcuts at runtime as shown below. This shows the shortcut numbers in the menu, but the shortcuts don’t work. I press the number key and nothing happens, whether or not the num pad is used (the menu items do work if I click them). The + and – shortcuts don’t work, either.
Another problem is that the – shortcut is shown as ‘-‘ in the menu for some reason, and the + shortcut is shown as ‘=’ because it’s the same key. I have also tried using TextToShortcut(), but no luck.
Is this possible in FMX, or will I have to resort to using the function keys? I’d prefer to have consistency with Inkscape. I could handle the key presses in the Form’s OnKeyDown event, but then how would I show the shortcut keys in the menu correctly (right hand side of the menu item)?
MenuItem1.ShortCut := vkEqual;
MenuItem2.ShortCut := vkMinus;
MenuItem3.ShortCut := vk1;
MenuItem4.ShortCut := vk2;
MenuItem5.ShortCut := vk5;
MenuItem6.ShortCut := vk3;
MenuItem7.ShortCut := vk4;

Comments are closed.