I’ve been having a heck of a time with menu shortcut keys. I’m talking here about using special (non-printable) keys - function keys, tab, enter, arrows, etc, by themselves, without menu modifiers. - as menu shortcuts and doing it on different platforms - Windows, Linux, and OS X. Sometimes they’d work, sometimes they wouldn’t. Also, sometimes they’d display in the menu correctly, sometimes they’d show up wrong, and sometimes they didn’t show up at all.
Getting frustrated, I decided to write a program testing all the special keys that can be used as menu shortcuts and running the program on all three platforms. I tested whether the keys worked or not, and also checked whether they displayed in the menu correctly. I charted the results - see below.
The Executive Summary:
Wow, am I confused. There doesn’t seem to be any rhyme or reason to this. First off, using PageUp, PageDown, Left, Right, Up and Down, as shown in the MenuItem documentation, doesn’t work at all in Windows or Linux. It does work on OS X, but, amazingly, PageUp activates the PageDown menu item and vice versa. Wild stuff. I did a little fiddling and found out the Page Up and Page Down works (note the spaces between the words), and Left Arrow, etc, works (note the word ‘Arrow’). However, this is only on Windows and Linux - OS X only works with the documented words (well, with PageUp and PageDown backwards). Home and End, which are not documented, actually work, but only on Windows and Linux - they don’t do anything on OS X.
How the shortcuts display in the menu is also strange. Everything in Windows is fine, but some of the Linux and OS X shortcuts display weirdly wrong. Of course, I expect the display to be weird if the key doesn’t work anyway, like many of the Linux shortcuts. However, for some of the keys in Linux that do work, the display is strange. It shows H and E for Home and End, Page up and Page down (not the lowercase u on up and the lowercase d on down) for Page Up and Page Down, and it doesn’t show anything at all for the arrows. On OS X, where it uses symbols instead of words, the symbol for backspace is wrong - it shows the symbol for delete. Nothing is displayed for Clear even though there is a symbol for it.
Why is all this happening? Good question. It may be issues in the operating systems, it may be issues with Xojo, and, obviously, it could be I’m doing something terribly wrong. Here are links to my test program and the Excel spreadsheet I used for my results. If anyone can tell me what’s going on, I’d appreciate it.
[code]This chart shows the function and the menu display of documented and undocumented special
keys used as menu shortcuts. Note that menu modifiers (control, command) are not used.
Function - This shows whether the shortcut key works or not.
Blank - The key works
X - The key doesn’t work
! - The wrong key is executed
N/A - The key doesn’t exist on that platform
Menu Display - This shows how the shortcut key is displayed in the menu. Note that OS X
uses symbols instead of words (except for Space).
Blank - The display is exactly the same as the shortcut key.
- Nothing is displayed.
Something Else - This is what is displayed instead of the shortcut key
Documented - These shortcut keys are documented on the MenuItem class page.
Undocumented - These shortcut keys are not documented on the MenuItem class page.
The program for this test was created with Xojo Version 2013 Release 2 (on Windows 7).
The Windows test was done on Windows 7.
The Linux test was done on Ubuntu 12.1 (Quantal Quetzal)
The OS X test was done on OS X 10.6.8 (Snow Leopard - Cocoa Intel)