One problem that I see people run into time and again has to do with keyboard shortcuts for menu items. Programmers on the Mac are spoiled by having four key modifiers for menu items: Command, Control, Option and Shift. However, on PCs, there's only three modifiers: Control, Alt and Shift. So how do you make shortcuts map? And what are the accepted standards with shortcuts?
Well, here's a short, handy guide for you.
On the Mac, almost every keyboard shortcut should be preceeded with a Command modifier. You use the Shift modifier when you are using an alternate form of a menu command. So Cmd+S would be save, and Cmd+Shift+S would be Save As. You use the Option modifier when you want to enlarge the scope of a command (make it "super"). So Cmd+Opt+S would be Save All. You should try to avoid using all four modifiers for a shortcut simply because it ends up being a finger-contorting shortcut.
On the PC, the rules are quite similar. You should prepend almost all shortcuts with the Control modifier. The same rule applies with the Shift key. So on the PC, Ctrl+S is Save, and Ctrl+Shift+S would be Save As. However, you should avoid using Ctrl+Alt keyboard shortcuts because they have special meanings on non-US systems. This is known as the AltGr key combo, and is used for typing characters. Let's say you had a keyboard shortcut Ctrl+Alt+S for Save All -- on a Polish user's system, they may have been typing an "Å›" character into an EditField!
So when is it appropriate to use Alt as a menu modifier? Simple -- when you're not using Ctrl as well. For example, every application has an Alt+F4 keyboard shortcut to close the focused window.
So how do you map keyboard shortcuts? To be honest, I wouldn't suggest you map every keyboard shortcut. Use the shortcuts that are appropriate on the Mac when designing your Mac app. And use a similar set when working on Windows and Linux. There's no sense in frustrating your PC users by trying to port over Mac keyboard shortcuts. And there's no sense in short-changing your Mac users by not using certain modifiers keys in your Mac app.
The most common thing to watch out for when working with keyboard shortcuts is to ensure that you don't have duplicate shortcuts. This can be surprisingly easy to run into if you're not careful. Always pay close attention when assigning new keyboard shortcuts. One handy, new feature of RB 2005 is that the menu editor will warn you when you assign a duplicate shortcut. Check the StatusBar when you assign the shortcut (or the menu text with a mnemonic) for warnings.
One question I've had regarding keyboard acceleration keys on Windows / RB... Are the control shortcuts on each panel of a tab control (or pagepanel) exclusive?
If you're talking about keyboard mnemonics (the underlined characters), then yes they are. Mnemonics work off of a particular view. When you switch a tab (or a page), then the view changes.
Thanks Aaron, you rock! :D