Page 1 of 1

Menu hotkeys under Windows

Posted: Fri Nov 16, 2018 5:37 pm
by jPV
I noticed that I can't get menu strip hotkeys work properly on Windows (10), while they do work perfectly fine on other platforms I've tried. Under windows some hotkeys just don't get triggered when pressing Ctrl+hotkey. Menu entries themselves do work if selected with the mouse.

Here's an example:

Code: Select all

MENU 1, {
    {"First menu", {
	{"test1", ID = "test1", Hotkey = "1"},
	{"test2", ID = "test2", Hotkey = "2"}}},
    {"Second menu", {
	{"test3", ID = "test3", Hotkey = "3"},
	{"test4", ID = "test4", Hotkey = "4"}}},
    {"Third menu", {
	{"test5", ID = "test5", Hotkey = "5"},
	{"test6", ID = "test6", Hotkey = "6"}}}
    }
@DISPLAY {Menu = 1}
NPrint("Try these hotkeys with the ctrl key: 1 2 3 4 5 6")
InstallEventHandler({OnMenuSelect=Function(msg) NPrint(msg.Action, msg.Item) EndFunction})
Repeat
   WaitEvent
Forever
When I run that under Windows and try to press ctrl-1, ctrl-2, etc, only 5 and 6 do work, 1-4 just don't trigger the event. If I remove the third menu, then items in the second menu do work. So it looks here that only the items in the last menu do work, but I think it's the case only with this certain example. I had another kind of menu structure, and there the working keys felt more random... didn't save it but can try to re-create it if needed.

Re: Menu hotkeys under Windows

Posted: Fri Nov 16, 2018 9:21 pm
by airsoftsoftwair
Nice find, fixed!

Code: Select all

- Fix [Windows]: Menu hotkeys didn't always work correctly

Re: Menu hotkeys under Windows

Posted: Sun Nov 18, 2018 11:28 am
by jPV
BTW. Non-alphanumeric hotkeys don't seem to work under Windows either, like "+", "-", ".", "?" etc. Is that some limitation of Windows itself or something to do with Hollywood?

Re: Menu hotkeys under Windows

Posted: Tue Nov 20, 2018 6:36 pm
by airsoftsoftwair
Mmh, I think anything else besides alphanumeric characters is currently pretty much undefined behaviour. I'll see if this can be fixed :)

Re: Menu hotkeys under Windows

Posted: Thu Dec 06, 2018 5:59 pm
by airsoftsoftwair
Well, at least +-,. work now. Everything else is rather difficult to support so better stick with those :)

Code: Select all

- Fix [Win32]: +-., weren't working as menu shortcuts

Re: Menu hotkeys under Windows

Posted: Sat Dec 08, 2018 4:31 pm
by airsoftsoftwair
Better fix implemented now. All characters should work as shortcuts now.

Code: Select all

- Fix [Win32]: Non-alphanumerical characters as menu shortcuts didn't work