O'Reilly logo

COCOA PROGRAMMING FOR MAC OS X SECOND EDITION by Aaron Hillegass

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Chapter 25. Updating Menus

In many applications, it is necessary to enable and disable menu items as the user interacts with the application. In particular, as the first responder changes, a menu item that is nil-targeted will need to be disabled if the responder chain does not respond to its action. By default, this activity is handled for you. When displaying itself, the menu item will automatically figure out if the current target has the appropriate action. If it does not, the menu item will be disabled.

When a menu item is deciding whether it should be enabled, it will ask its target if it implements validateMenuItem:. If so, the target is sent validateMenuItem:. If the target returns YES, the menu item is enabled.

To enable and disable menu ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required