Copyright ã1996 by NeXT Software, Inc.  All Rights Reserved.

;LayeringObjects.rtfd;;¬  Next Section	;CreatingMatricesOfObjects.rtfd;;¬  Previous Section

Creatingmenus;¬Creating menus

1	Drag a menu item from the Menus palette.

2	Drop it between two menu items in your application's menu.

Menus are just as important as windows and panels for an interface. Menu commands initiate most of the standard functions of an application, such as printing, opening files, or cutting and pasting text. That's why Interface Builder's Menus palette holds a number of ready-made submenus and menu items.

¬

Click several menu items in your application's main menu and note how some cells in the submenus are dimmed. Dimmed cells indicate that, as the default, the command is inactive until some condition occurs in your code that causes your application to activate the command.

You delete a menu item just as you do with any other object in Interface Builder: select it, then choose the Cut command from the Edit menu (Command-x) or press the Delete key. Also, as with other Interface Builder objects that display text, you can easily change the titles of menu items: 

¬	Double-click the text to select it
¬	Type the new title or edit the old one 
¬	Click outside the cell to set the new title or press Enter

You can also do two special tasks with menu items: re-sequencing and assigning Command keys. By re-sequencing, you change the order in which items are listed in a menu. By assigning a Command key to an item, you give the user of your application a command key equivalentÐa shortcut way to invoke the command (as Command-x is a shortcut for invoking the Edit menu's Cut command). 

¬

Custom menus

In addition to the standard menu commands and submenus, Interface Builder makes it easy for you to compose your own custom menus. Use the Submenu cell in the Menus palette to create custom submenus and use the Item cell for custom menu commands. The Print command is frequently added as a custom cell.

¬

Change the title of Submenu and click the cell to expand it. Then add Items from the Menus palette to the new submenu and change their titles.

You can make menu items active or inactive by default. Select the item and set the Disabled button in the Attributes display of the cell's Inspector. See Chapter€3, ªSetting an Object's Attributesº for more information on using the Inspector panel.  ;../03_SettingObjectAttributes/SettingAttributesOfMenuCellsAndPopUpLists.rtfd;;¬

See Chapter€4, ªMaking and Managing Connectionsº to learn what you must do to connect menu items with the objects that are to handle menu commands.  ;../04_Connections/Connections.rtfd;;¬