Anomalies in keyboard shortcuts for menus on Mac

Anything beyond the basics in using the LiveCode language. Share your handlers, functions and magic here.

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
kaveh1000
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 508
Joined: Sun Dec 18, 2011 7:23 pm
Location: London
Contact:

Anomalies in keyboard shortcuts for menus on Mac

Post by kaveh1000 » Thu Dec 19, 2019 5:46 pm

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.
Attachments
shortcuts.jpg
Kaveh

FourthWorld
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 9837
Joined: Sat Apr 08, 2006 7:05 am
Location: Los Angeles
Contact:

Re: Anomalies in keyboard shortcuts for menus on Mac

Post by FourthWorld » Thu Dec 19, 2019 6:41 pm

The Shift key alters the availability of "/".
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn

kaveh1000
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 508
Joined: Sun Dec 18, 2011 7:23 pm
Location: London
Contact:

Re: Anomalies in keyboard shortcuts for menus on Mac

Post by kaveh1000 » Thu Dec 19, 2019 7:00 pm

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
Kaveh

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 9663
Joined: Wed May 06, 2009 2:28 pm
Location: New York, NY

Re: Anomalies in keyboard shortcuts for menus on Mac

Post by dunbarx » Thu Dec 19, 2019 9:14 pm

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

FourthWorld
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 9837
Joined: Sat Apr 08, 2006 7:05 am
Location: Los Angeles
Contact:

Re: Anomalies in keyboard shortcuts for menus on Mac

Post by FourthWorld » Fri Dec 20, 2019 3:53 pm

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.
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn

kaveh1000
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 508
Joined: Sun Dec 18, 2011 7:23 pm
Location: London
Contact:

Re: Anomalies in keyboard shortcuts for menus on Mac

Post by kaveh1000 » Fri Dec 20, 2019 9:36 pm

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.
Attachments
testing_shortcuts.zip
(866 Bytes) Downloaded 167 times
Kaveh

FourthWorld
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 9837
Joined: Sat Apr 08, 2006 7:05 am
Location: Los Angeles
Contact:

Re: Anomalies in keyboard shortcuts for menus on Mac

Post by FourthWorld » Sat Dec 21, 2019 12:27 am

Thanks, Kaveh. Very helpful to have the example stack. I'll poke around on my Mac later and let you know what I find.
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn

[-hh]
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 2262
Joined: Thu Feb 28, 2013 11:52 pm
Location: Göttingen, DE

Re: Anomalies in keyboard shortcuts for menus on Mac

Post by [-hh] » Sat Dec 21, 2019 1:33 pm

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).
shiftLock happens

kaveh1000
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 508
Joined: Sun Dec 18, 2011 7:23 pm
Location: London
Contact:

Re: Anomalies in keyboard shortcuts for menus on Mac

Post by kaveh1000 » Sun Dec 22, 2019 12:37 pm

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.
Kaveh

Post Reply

Return to “Talking LiveCode”