Page 1 of 1

Anomalies in keyboard shortcuts for menus on Mac

Posted: Thu Dec 19, 2019 5:46 pm
by kaveh1000
I am trying to attach keyboard shortcuts to menus using the Menu Builder. I find that there are inconsistencies, especially in the way the shift key is applied. To exemplify the problem, I have created several screenshots of what I set up and the resultant keyboard combination that works successfully. Any ideas why i get the anomaly appreciated.

I am using Indy 9.5.0 using Catalina.

Re: Anomalies in keyboard shortcuts for menus on Mac

Posted: Thu Dec 19, 2019 6:41 pm
by FourthWorld
The Shift key alters the availability of "/".

Re: Anomalies in keyboard shortcuts for menus on Mac

Posted: Thu Dec 19, 2019 7:00 pm
by kaveh1000
Thanks Richard. So "/" is a special key?

I tried another key combination, setting

Command Shift d

this is envoked correctly by "Command shift d". But setting Command-d is not triggered by any key combination

Re: Anomalies in keyboard shortcuts for menus on Mac

Posted: Thu Dec 19, 2019 9:14 pm
by dunbarx
Kaveh.

Cmd-Shift-d (ASCII 68) is the same as shift-d (ASCII 68), at least as the rawKey message is concerned. In other words, to rawKey, the CMD key may as well not exist.

I am not sure how you are working this, but you may need to test the state of the "control" keys in conjunction to identifying a keypress. LC itself knows when the CMD key is pressed.

Craig

Re: Anomalies in keyboard shortcuts for menus on Mac

Posted: Fri Dec 20, 2019 3:53 pm
by FourthWorld
FWIW I tried a few of these combos on Linux and was unable to reproduce the results you're seeing. While I realize you reported seeing that in Mac, Linux is often a good test case for GUI anomalies given how relatively little attention it gets compared to Mac, as just about everyone there uses Macs daily.

I'll see if I can make some time to explore this further on my Mac over the weekend. In the meantime, it may be helpful to double-check that you have no frontscripts or other handlers which may be interfering with your test.

It would help encourage others to test what you're seeing if you can post a simple example stack that exhibits the errant behavior.

Re: Anomalies in keyboard shortcuts for menus on Mac

Posted: Fri Dec 20, 2019 9:36 pm
by kaveh1000
Thanks for your time Richard. Here is a "very" minimal stack. I have set the shortcut for the menu item to Command Shift /. The menu item triggers when I press Command /, but not when Shift is down.

Re: Anomalies in keyboard shortcuts for menus on Mac

Posted: Sat Dec 21, 2019 12:27 am
by FourthWorld
Thanks, Kaveh. Very helpful to have the example stack. I'll poke around on my Mac later and let you know what I find.

Re: Anomalies in keyboard shortcuts for menus on Mac

Posted: Sat Dec 21, 2019 1:33 pm
by [-hh]
Menu Builder:
This is not an anomaly but what we need to use shift-chars (that is you need shift to have it) or alt-chars (that is you need option/alt to have it) or both.
For example, if you have a key on your keyboard that has "/" as lower char and "?" as shift-char. Then
  • builder: cmd + "/" --> fires
  • builder: cmd + shift + "/" --> doesn't fire because "/" is not a shift-char (actually you use cmd + "?")
  • builder: cmd + "?" --> fires (actually you use cmd + shift + "/" to trigger it with our key example)
  • builder: cmd + shift + "?" --> fires
The same logic holds for Option (Alt).

Re: Anomalies in keyboard shortcuts for menus on Mac

Posted: Sun Dec 22, 2019 12:37 pm
by kaveh1000
Thanks for that. I think I will just stick to alphabetic characters. I can then used upper and lower case chars for shortcuts which is useful. I note that I can't replace shortcuts currently in use by the application either, e.g. command n. But that is fine.