O'Reilly logo

Learning Carbon by Apple Computer Inc

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 7. Interface Builder: Menus

Every Carbon application must support menus—the standard ones supplied by Mac OS X and those your application provides. Menus allow users to view or choose from a list of choices any commands or attributes provided by your application. You can add application-specific menus and customize many of the standard menu items to suit your application’s needs.

The easiest way to create, display, and set up the behavior of pull-down, hierarchical, and contextual menus is to use Interface Builder. It provides you with a menu bar that’s already loaded with the standard menus and items. To set up the menus for your application, do the following steps:

  1. Modify the default menu bar by:

    • Disabling the items your application doesn’t need

    • Preparing the items your application needs

    • Adding application-specific menus and menu items

  2. Add code to your project to:

    • Call Interface Builder Services to create the menu bar from the nib file

    • Process the menu commands

In this chapter, you’ll:

  • Look at a typical menu bar for an application running on Mac OS X

  • Go through the menu bar provided by Interface Builder to see which items are set up for you and which ones you need to prepare

  • Discuss hierarchical and contextual menus

  • Modify the menu bar for the Moon Travel Planner application

The Menu Bar

The Mac OS has a menu bar with a number of standard menus and menu items that should appear in any application. Figure 7.1 shows the menu bar for the Finder on Mac OS X. The Apple menu on the ...

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