What happens when I select “List”?
Here’s a truly rare bird: a UI heuristic where most GUI toolkits get it right, but Apple (Cocoa) goes horribly wrong.Â In the above example, what will happen when “List” is selected?Â On the Mac (right), It’s not clear, is it?Â Will “List” also become checked, or will “Large Icons” become unchecked?
In virtually all pull-down menu implementations across all platforms, there are basically three types of functionality for any menu item (which does not have a submenu, and is not a separator):
- Standard Item
- Checkbox Item
- Radio Item
The Standard item is handled perfectly well in Cocoa. You click it, the menu closes, its function is performed.
Similarly, a Checkbox-style item works just fine in Cocoa. You click it to turn something on. It gains a checkmark indicator, and something is on. You click it again, checkmark goes away, and something is off. Cocoa even supports a “mixed” state, which displays a dash in front of the item.
However, there is no built-in way to handle a Radio-style group of menu items in Cocoa. In order to properly implement a group of radio items in a Cocoa menu, you have to do four things:
- Create a “Bullet” image to perfectly match the feel of the Check image used by the system.
- Add add several NSMenuItems to your menu.
-setOnStateImage:to each NSMenuItem that will be part of the radio group.
- Implement the controller logic or binding magic to keep only one item in the “on” state.
Other toolkits â€” including GTK+, Swing, and Windows â€” have methods of creating menu item radio groups, and use a different symbol, just as forms do, to differentiate checkboxes from radio items. To be sure, this is one of the precious few glaring omissions I’ve ever seen in the AppKit toolbox since I started with it in 1993; however, that makes it no less bug-worthy.
It’s time for Apple to appropriate one more feature from its competition.Â I Demand Better User Experience.