One might ask: "how do you pick menu shortcuts?" during the course of designing their user interface. It's pretty easy to overloook them, and to do them improperly. So I just want to write a few quick things to keep in mind.
Don't forget to include shortcuts!
If you want to have a professional application, you better remember to add menu shortcuts. They're blindingly easy to add, but equally easy to forget about. Don't make the mistake of not including any because it tends to be a UI no-no. Keyboard shortcuts provide quick access to the most frequently used menu items in your application. So if you have menu items that you suspect will be used with any frequency, you should think about shortcuts for them. And if none of your menu items are used with frequency, then you should take a long, hard look at the purpose of having them as menu items. ;-)Use standards when possible
There are some standard keyboard shortcuts out there that every application uses. Don't deviate from them. If you decided to change Copy from Ctrl+C or Save from Ctrl+S, you'd have quite the outcry from confused users. So if there is a standard shortcut for an operation, go ahead and use it.But there are standards, and then there are "standards." Remember that other applications have come before you (generally speaking), and so if your application has similar functionality to another popular application, you may want to consider using the same shortcuts. Here's a good example: you're writing an application which has a visual editor of some kind, and you have the ability to zoom in on the picture. Well, most application that have zoom functionality use Ctrl+= to zoom in (because the + glyph is on that key) and Ctrl+- to zoom out. Granted, there's no hard-and-fast rule which calls this a standard. But it's sensible, and it works.
Watch out for duplicate shortcuts
After a while, you may run into the problem of doubling up your shortcuts. Don't do this -- it can be very annoying. It's easy to miss duplicate shortcuts if you're not watching for them, but as a user, you get unpredictable behavior. In some cases, hitting a particular combination produces one set of results. And in another case, it produces another set of results. Don't believe me? Check out RB2006r2. Replace and Find Next has a shortcut of Cmd+T on the Mac. So does Stop Debugging. Quite different operations, no?Don't go overboard
Just like some people go underboard by not putting any shortcuts in, you should also make sure you don't go overboard. Not every menu item requires a keyboard shortcut. Only the operations which happen with frequency. To pick on REALbasic some more -- there are places where we've done it right by skipping a shortcut, and some places we've done it wrong. For instance, there's no reason to have a keyboard shortcut for Encrypt/Decrypt Item (in the Edit menu). It happens very infrequently, and so why waste the available shortcut? But then again, I'd also claim that opening the build settings dialog happens infrequently, and so it should not have the Ctrl+Shift+B shortcut that it's using. There are over 100 menu items in the IDE, and I think an overhaul to remove some of the lesser-used shortcuts might not be a bad idea in some cases. But overall, I don't think we're doing too bad (I'd say we're borderline overboard).Picking your own
You will more than likely end up running into a situation where you need to pick your own shortcut. The general rules I always use are these:- Try to use the first letter in part of the command. So if you have Be Nice and Be Mean, you might want to pick Ctrl+N and Ctrl+M.
- If you can't pick one of the titlecase letters, then try to pick the letter which has the mnemonic. So if you have Be Ni&ce and Be M&ean, then Ctrl+C and Ctrl+E would work.
- Don't use Ctrl+Alt (on Windows or Linux) for shortcuts because that'll wreak havoc with international keyboards.
- On the Mac, Opt means "do it more", and shift means "do it different." So if you have Save, Save As and Save All, the shortcuts would be Cmd+S, Cmd+Shift+S and Cmd+Opt+S (respectively).
- On Windows and Linux, Shift means "do it different or more." Since there's one less keyboard modifier, it has to do double duty. So on Windows, you'd typically see Ctrl+S for Save and Ctrl+Shift+S for Save All and no shortcut for Save As (since the thought is that you'd Save All more than you'd Save As).
- With all of these rules, remember to watch out for duplicates or stealing common shortcuts.
But then again, I’d also claim that opening the build settings dialog happens infrequently, and so it should not have the Ctrl+Shift+B shortcut that it’s using.
I disagree; I find the Ctrl+Shift+B shortcut handy, especially on Mac since I have to occasionally switch between PEF and Mach-O when running an app in debug mode.
In my opinion, better candidates for deletion--if it were truly necessary--would be Cmd+E "Editor Only" (pretty much obsolete with certain recent changes), Cmd+Shift+H "Go Home" (just give us Cmd+0 back), or "Cmd+Shift+A" Deselect All (never used that one before!).
And by the way, I just noticed that "Replace" and "Move Forward" both share Cmd+= as a shortcut as well.
On the Mac, Opt means “do it moreâ€, and shift means “do it different.â€
Nice to know. I would certainly agree now that I think about it. Do you have a specific source, or are you just extrapolating from observed practice?
Don’t use Ctrl+Alt (on Windows or Linux) for shortcuts because that’ll wreak havoc with international keyboards.
Really, really nice to know. Perhaps the REALbasic IDE could warn us, at least via the status bar, about this.
One more question about menus: which is recommended, setting the ShortcutKey text to "Cmd+S" or setting ShorcutKey to "S" and checking the Command checkbox? This is confusing to me. Is the former deprecated or fully supported?
@Adam -- good point on the candidate for removal. But you should file a report about the new dupe.
As for the "do it more", it's in the HIG (ya know, that document that people think I know nothing about).
As for warning about Ctrl+Alt, it's not a bad idea, but there are still valid places it gets displayed or used (such as Ctrl+Alt+F key is fine since it's never used for textual input).
About setting the keys, use the checkboxes. They're explicit and there's no chance of spelling errors causing pain. The former isn't officially deprecated (since it's the way you do things at runtime), but the latter is certainly recommended over the former at design time.
On the dupe shortcut:
http://realsoftware.com/feedback/viewreport.php?reportid=aqsbdzhx
Well, now that I know that certain Ctrl+Alt shortcuts are acceptable and others aren't, that's even more reason to implement it as a tip in REALbasic! The less we need to know, the better. In fact, I've submitted a feature request:
http://realsoftware.com/feedback/viewreport.php?reportid=mennouqy
Thanks!
The trouble with that request is that it would require REALbasic to know when it's appropriate and when it's not, which is essentially impossible to know. Ctrl+Alt+F may be a perfectly reasonable (and normal) shortcut for a Chinese application, but not for a German one (just pulling nationalities out of the air). So it's a tough call on that request...
Hmm, that is tough. Obviously, that would make compile-time warnings appropriate, but that's a whole different piece of pie.
Now, can you please do an article on Windows localization? I'm confused. Does dynamic localization work or not? Can I test my app in different languages without buying the Windows multilingual expansion pack? What should I be aware of?
Thanks.
I can see about writing something up quick. It does work for Windows, and AFAIK, you just need to go into the regional settings and specify what language to use (it can go on an app-by-app basis, IIRC) to test it out. But I'll figure things out; that'd be a good little blurb for a blog posting.
Oh, sorry, I didn't mean I need answers right away about Windows localization; just an idea for a future topic. You could make it an RBLibrary article; I'd buy it.
And I think my Regional Settings doesn't have a language option, and that you need to have the multilingual pack to change it. I was wondering if there was a way to "fake it" so that the RB app would think it's on a different language setting.
Thanks.
I think he meant Ctrl-Alt and a function key, not Ctrl-Alt-Foxtrot which could well be a real character. I'd still avoid that, because on a laptop keyboard, it's a triple-bucky (you have to hold down three modifiers, which aren't even all adjacent--the logo key is in between).
Good point silverpie, I forgot all about laptops having a different keyboard layout as well. That'd be another thing to watch out for -- any finger-contorting combinations should be avoided, otherwise they're not much of a shortcut.
Great example of finger-contorting, the pre-RB2005 shortcut for opening the build settings dialog: Ctl+Alt+Shift+M