Parmanoir

Clickable Disabled MenuItems

There's been some talk about menu items at Joel on Software and ignore the code. If a menu item refers to an action that can't be done right now, should the menu item be :
  • disabled : the default. You can't click it, you don't know why.
  • active : click it and show an alert explaining why it can't be done.
  • disabled + tooltip : a short delay hovering the disabled item will explain why it is disabled.

And the fourth option, that you all remember when trying to go fullscreen with Quicktime :

  • active but greyed out : the menu item can be selected, clicked (it will then show an alert), and it looks disabled !

Image:Clickable Disabled MenuItems.png

Let's launch F-Script and see how it's done : NSMenuItem uses a default font and color, but you can customize it via NSAttributedString.

I did not try it in code, but I suppose it's just a quick change in validateMenuItem: : always return YES, and change the NSMenuItem color when it should be disabled.

Alexander Repty
2008 07 04

I think this really is the solution to this problem. It is obvious at first look that the menu item is disabled and thus the user knows that it won't work right now. The "PRO" label also tells the user that they need to purchase the pro version of the application to enable the functionality, and if they need more info about it, they can just click the menu item.

Once more, Apple solved the problem before we even knew there was one.

Patrick Geiller
2008 07 04

Yes, it's really a nice solution. It's too bad that Apple is using it to nag you into paying for more software instead of using it as help.

One nice example of this mechanism as help would be in Pages, for 'Instant Alpha' : its activation is not obvious — it only works on an image selection — and opening a window explaining that would be nice.


Follow me on Twitter
Planet Cocoa
Cocoa.fr

2011 02 22Distance field
2010 07 202Binding through NSApp
2010 05 122Forwarding invocations
2010 02 272Core Image black fringes
2010 02 21Quickest Way to Shell
2010 02 08Who's calling ?
2009 09 2138 ways to use Blocks in Snow Leopard
2009 08 182Bracket Mess
2009 08 124Taming JavascriptCore within and without WebView
2009 04 15Debugging with Activity Monitor
2009 03 25How Core Image Color Tracking works
2009 03 1510Custom NSThemeFrame
2009 03 10Which framework is running ?
2009 03 074CoreUI can paint pretty big
2009 02 18Localization with functions
2009 01 30Did you forget to nest alloc and init?
2009 01 16JSCocoa on the iPhone
2009 01 11Mixing WebView and JavascriptCore
2009 01 09Badge overflow
2009 01 09Find your Garbage Collection leaks with Instruments

Powered by MediaWiki