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

2009 04 15Debugging with Activity Monitor
2009 03 25How Core Image Color Tracking works
2009 03 154Custom 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
2008 12 19384 percent dynamic
2008 12 15Class pairs and super
2008 12 113Redirecting NSLog to a file
2008 12 10Whoops ! super is not runtime
2008 12 09Don't overload release or retainCount in JSCocoa
2008 12 05Sidestepping JavascriptCore's JSEvaluateScript
2008 12 031Multiple processes rendering to one window
2008 12 02When does autorelease release ?
2008 12 02Process Sandboxes : an easy path to security ?
Image:rss.png
Image:rss.png

Powered by MediaWiki

Hi ! I'm learning Cocoa to (hopefully !) become an indie developer.

I've written software all my professional life, in C++, PHP, Javascript. I've designed websites and web interfaces. My last venture went into flames as clients were happy but didn't like paying very much.

I've had little luck in the B2B world, I'm hoping for a better future writing Mac applications.