Avoiding illegal menu shortcuts

Deploying to Windows? Utilizing VB Script execution? This is the place to ask Windows-specific questions.

Moderators: Klaus, FourthWorld, heatherlaine, kevinmiller, robinmiller

jmk_phd
Posts: 124
Joined: Sat Apr 15, 2017 8:29 pm

Avoiding illegal menu shortcuts

Post by jmk_phd » Mon Jul 19, 2021 10:54 pm

I’ve included menu shortcuts in an application so users need not resort to using the mouse/trackpad to click the corresponding radio buttons. As a Mac user, I chose what seemed sensible choices — which worked just fine — and the LC Menu Builder dutifully remapped these to the corresponding modifier keys when I built the Windows standalone.

When several of these did not work when I tried running the app in virtualization via Parallels, I figured that it was just a quirk. However, the only person I know who uses Windows confirmed that this was an actual problem.

I understand that ignorance of Windows conventions is no excuse, but can anyone suggest a straightforward source of shortcuts that must be avoided?

For example, I have a set of radio buttons that correspond to the keys of the musical scale — C C# D D# ... A — that are represented also as items with menu shortcuts in a menu designated “Tonics”.

On a Mac, I used Option+C for “C” and Control+Option+C for “C#” , etc. (adding the Control key sensibly specified that the item is sharped).

LC converted these in the Windows menu to Alt+C and Ctrl+Alt+C. The latter works, but the former does not -- presumably because the former is already reserved by the Windows OS.

I prefer to avoid having users practice digital gymnastics — digital here referring to fingers and not to numbers — to trigger shortcuts. That defeats the purpose of making this more user-friendly. (Long-time Mac users may recall the nearly impossible feat of resetting the PRAM via the keyboard.)

A sensible system that works both for macOS and Windows is needed. (BTW, a few shortcuts — e.g., Ctrl+[number 1-7] and Ctrl+[M/R/P] — are already in use.)

Thanks much.

jeff k

richmond62
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 5893
Joined: Fri Feb 19, 2010 10:17 am
Location: Bulgaria

Re: Avoiding illegal menu shortcuts

Post by richmond62 » Tue Jul 20, 2021 7:40 am

Unfortunately Linux and Windows only allow access to 4 standard modifier keys:

capsLock, Shift, Alt and Control

While Macintosh also offers Command

and Windows has the Logo key

and some Linux distros have the Super key (which is so super I haven't worked
out if that means the one with the Windows Logo).

Personally, to avoid any cross-platform headaches, I avoid anything to do with
either Control or Command, and tend to use the Alt modifier key a lot.

Mind you, if you really want to be sure:

http://www.mindpride.net/root/Extras/sh ... ations.htm

Or, run Windows (you can set the trial version up in a virtual machine) and spend a tedious day writing down all the key-combos.

In fact, being a cross platform chap myself (Linux and Macintosh) all my Macintoshes are
set so the Command and Control are reversed so I don't have to go bonkers remembering
(or reminding children I teach) that on Macintosh the Command key functions like the
Control key on Windows and Linux.
-
Screen Shot 2021-07-20 at 9.40.13 AM.png

jmk_phd
Posts: 124
Joined: Sat Apr 15, 2017 8:29 pm

Re: Avoiding illegal menu shortcuts

Post by jmk_phd » Tue Jul 20, 2021 11:51 pm

Thanks much for your reply, Richmond.

The webpage of Windows key commands you identified is easier to read and research than others I’ve found. I expected to find in that list the problem combinations, but no such luck.

About six years ago another valued contributor to the forums wrote
The menuBuilder seems like a great tool, and it is. But it also is haunted.
I’m not quite sure what he had in mind, but the Shortcut feature at the bottom right of the Menu Builder is at least rather cryptic and (as far as I can tell) not that well documented.

Image

When Shortcut is checked and a + [key] is entered, checking “Cmd” inserts the cloverleaf Command symbol in a Mac menu and “Ctrl+” in the corresponding Windows menu. Makes sense.

When “Ctrl” is checked, it inserts the Control symbol on a Mac, and “Ctrl+” in the Windows menu. Okay.

When “Alt” is checked, it inserts the Option symbol on a Mac, and “Alt+” in the Windows menu.

Whereas (for example) “Ctrl+Option+[key]” on the Mac and the corresponding “Ctrl+Alt+[key]” in Windows do both work, the Mac “Option+[key]” works whereas the Windows “Alt+[key]” does not. (I may use the Shift key in place of one or the other, inasmuch as -- for those familiar with a piano keyboard -- the sharped keys appear raised relative to the white keys.)

Unless a smarter LiveCoder can suggest an alternative, I suppose that I must edit the shortcuts in Menu Builder using different combinations, then build and test the standalones in macOS and in Windows 10 (via Parallels) to know for sure which work.

jeff k

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

Re: Avoiding illegal menu shortcuts

Post by FourthWorld » Wed Jul 21, 2021 12:54 am

Being designed for cross-platform ease-of-development, LiveCode automatically maps the Win/Linux Ctrl key to the macOS Cmd key, and the Win/Linux Alt key to the macOS Option key.

Shift is the same everywhere.

The Windows key doesn't exist on Apple keyboards at all.

Have fun.
Richard Gaskin
LiveCode Community Liaison

LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn

richmond62
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 5893
Joined: Fri Feb 19, 2010 10:17 am
Location: Bulgaria

Re: Avoiding illegal menu shortcuts

Post by richmond62 » Wed Jul 21, 2021 7:26 am

& the "Super" key?

Oh, how extremely disappointing:

https://en.wikipedia.org/wiki/Super_key ... rd_button)
-
Superkey.png
-
Mind you . . . .
-
Fnuck.jpeg
Fnuck.jpeg (2.98 KiB) Viewed 825 times
shiftLock.jpeg
shiftLock.jpeg (5.79 KiB) Viewed 825 times

jmk_phd
Posts: 124
Joined: Sat Apr 15, 2017 8:29 pm

Re: Avoiding illegal menu shortcuts

Post by jmk_phd » Wed Jul 21, 2021 8:37 am

Geez, Richmond --

Your posts are always interesting, and typically -- as most folks on these forums would admit -- often both entertaining and frequently provocative.

But -- sorry -- your last reply was simply a useless and unhelpful distraction from your previous helpful comments. I was disappointed.

jeff k

richmond62
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 5893
Joined: Fri Feb 19, 2010 10:17 am
Location: Bulgaria

Re: Avoiding illegal menu shortcuts

Post by richmond62 » Wed Jul 21, 2021 9:43 am

I was disappointed.
Sorry. early morning before the coffee had worked its way through my system.

richmond62
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 5893
Joined: Fri Feb 19, 2010 10:17 am
Location: Bulgaria

Re: Avoiding illegal menu shortcuts

Post by richmond62 » Wed Jul 21, 2021 10:18 am

Now I'm fully "tanked up":

Have a look at this: https://www.softpedia.com/reviews/mac/K ... 7639.shtml

This is for Macintosh

"When invoked, it will present a floating bevel which contains all the keyboard shortcuts
available in the currently active application, along with their descriptions, ordered in
he way the can be found within the menus themselves."

This is for Windows:

https://alternativeto.net/software/cheatkeys/about/

and this is endlessly tedious:

https://support.microsoft.com/en-us/win ... 9706c75eec

jacque
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 6119
Joined: Sat Apr 08, 2006 8:31 pm
Location: Minneapolis MN
Contact:

Re: Avoiding illegal menu shortcuts

Post by jacque » Wed Jul 21, 2021 6:17 pm

I’m not quite sure what he had in mind, but the Shortcut feature at the bottom right of the Menu Builder is at least rather cryptic and (as far as I can tell) not that well documented.
There is more documentation in the User Guide. The menu builder is just a GUI for what you can do manually.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com

jmk_phd
Posts: 124
Joined: Sat Apr 15, 2017 8:29 pm

Re: Avoiding illegal menu shortcuts

Post by jmk_phd » Wed Jul 21, 2021 10:54 pm

jacque wrote:
Wed Jul 21, 2021 6:17 pm
I’m not quite sure what he had in mind, but the Shortcut feature at the bottom right of the Menu Builder is at least rather cryptic and (as far as I can tell) not that well documented.
There is more documentation in the User Guide. The menu builder is just a GUI for what you can do manually.
You may be right, of course, but even in the LC 9.x User Guides this shortcut feature seems to be skipped over.

jmk_phd
Posts: 124
Joined: Sat Apr 15, 2017 8:29 pm

Re: Avoiding illegal menu shortcuts

Post by jmk_phd » Thu Jul 22, 2021 5:38 am

Thanks again to everyone who has posted such helpful replies.

No doubt you've all been there at one time or another, but I'm feeling pretty worn out at the moment, juggling the Win/Mac shortcut issue with this music app, along with a second app that's failing on account of a buggy third-party extension (not my fault) and a third (which worked fine in LC 8 but breaks in LC 9) that forum members are currently helping me to grapple with here in another forum.

At least this one seemed simple enough to resolve by breaking Apple's UI guidelines. Because this app does not employ any editing of files, I've resorted to -- for example -- using Cmd-C to select a musical chord in C and Shift-Command-C to select the chord in C#. These are rendered as Control-C and Shift-Control-C in Windows10 and seem to work fine (at least when run in emulation on a Mac via Parallels).

I've yet to find out whether this passes Apple's "smell test" when signing and notarizing an app for distribution outside the App Store. And of course this is of no help to LC programmers who do need the conventional shortcuts in the Edit menu. But as long as it works....

jeff k

jacque
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 6119
Joined: Sat Apr 08, 2006 8:31 pm
Location: Minneapolis MN
Contact:

Re: Avoiding illegal menu shortcuts

Post by jacque » Thu Jul 22, 2021 7:54 am

Apple doesn't review apps when they are signed and notarized for outside distribution, it's strictly a verification of identity done by a bot. So no worries there.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com

jacque
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 6119
Joined: Sat Apr 08, 2006 8:31 pm
Location: Minneapolis MN
Contact:

Re: Avoiding illegal menu shortcuts

Post by jacque » Thu Jul 22, 2021 9:05 pm

jmk_phd wrote:
Wed Jul 21, 2021 10:54 pm
You may be right, of course, but even in the LC 9.x User Guides this shortcut feature seems to be skipped over.
It's kind of buried in a paragraph about using the Menu Builder:
To create a control key shortcut for the item, click the Shortcut check box and enter the letter you want to use for the shortcut. To understand the symbols that are created next to the menu items, see the section on Menu Bars within the chapter on Programming a User Interface.
I've found it handy when I can't remember the designated symbols for various control keys. It fills them in for you.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com

jmk_phd
Posts: 124
Joined: Sat Apr 15, 2017 8:29 pm

Re: Avoiding illegal menu shortcuts

Post by jmk_phd » Fri Jul 23, 2021 1:47 am

Jacque --

Thanks much for the reassurance that I won't run into a "gotcha" regarding menu items when signing/notarizing an app for distribution outside the App Store.

As regards Menu Builder, the Shortcut checkbox options -- Ctrl Cmd Shift Alt -- and their description in the Manual just seem a bit cryptic. So I really knew not what to expect until I built the Mac and Windows standones to see how the respective menus were displayed.

For example, the "Cmd" checkbox yields the expected "cloverleaf" Command icon in a Mac menu, yet substitutes "Ctrl+" in Windows -- despite the fact that there is a separate "Ctrl" checkbox. The "Ctrl" checkbox does *also* insert "Ctrl+" into a Windows menu -- which seems redundant -- while inserting the Control symbol into a Mac menu.

The only unambiguous checkbox option is "Shift".

I assume that the LC folks had some rationale for this checkbox design, so perhaps I am the only one to have found this confusing.

jeff k

jacque
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 6119
Joined: Sat Apr 08, 2006 8:31 pm
Location: Minneapolis MN
Contact:

Re: Avoiding illegal menu shortcuts

Post by jacque » Fri Jul 23, 2021 7:25 pm

I assume that the LC folks had some rationale for this checkbox design, so perhaps I am the only one to have found this confusing.
Actually it was implemented in MetaCard originally so it's been that way for, what, 20 years? The Command key on Mac and Control key on Windows are functionally the same, so Cmd maps to Control on Windows. Windows doesn't have a parallel key for Mac's Control key exactly so those two map the same. Option (Mac) and Alt (Windows) are mapped to each other. This provides cross-platform compatibility without needing to branch code by platform.

There's a note in the dictionary in the "menu" entry:
As Windows and Linux do not have the 'Command' modifier, on those platforms 'Command' is an synonym for 'Control'. To ensure cross-platform uniformity it is important that you use 'Command' in preference to 'Control' since 'Control' on Mac OS X is a less frequently used modifier.
This setup has been the same forever, but a while back an addition was made to add a tag to the menu item string. This allows you to display a menu item in a different language while still receiving the same parameter in a menupick handler.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com

Post Reply

Return to “Windows”