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.
- Send
-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.
http://www.nibfile.com/blog/?p=34
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。