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 ...

Get COCOA PROGRAMMING FOR MAC OS X SECOND EDITION now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.