Legacy Documentclose button

Important: The information in this document is obsolete and should not be used for new development.

Previous Book Contents Book Index Next

Inside Macintosh: Macintosh Toolbox Essentials /
Chapter 3 - Menu Manager / Menu Manager Reference
Menu Manager Routines


Responding to the User's Choice of a Menu Command

When the user presses the mouse button while the cursor is in the menu bar, your application should call the MenuSelect function to allow the user to choose a command from the menu bar. If the user presses the mouse button while the cursor is over a pop-up menu that does not use the standard pop-up control definition function, your application should call the PopUpMenuSelect function to allow the user to make a choice from the pop-up menu.

You should also allow the user to choose a menu command by typing a keyboard equivalent. When the user presses a key on the keyboard, your application should determine if the Command key was pressed at the same time, and, if so, your application should call the MenuKey function to map this keyboard combination to any corresponding Command-key equivalent.

If the user chooses an item, both the MenuSelect and MenuKey functions highlight the title of the menu containing the chosen item and report the user's choice to your application. Your application should perform the corresponding command and, when finished, should unhighlight the menu title using the HiliteMenu procedure to indicate to the user that the command is completed.

If the user releases the mouse button while the cursor is over a disabled item or types the keyboard equivalent of a disabled item, MenuSelect and MenuKey do not report the menu ID or menu item of the item. To determine if the user chose a disabled item (for example, so that your application can provide assistance to the user or explain to the user why the command is disabled), you can use the MenuChoice function to return the menu ID and menu item of the disabled menu command.

Your application should adjust its menus before calling MenuSelect or MenuKey. For example, you should enable or disable menu items as appropriate and add any applicable checkmarks or dashes to items that show attributes.


Subtopics
MenuSelect
MenuKey
MenuChoice
HiliteMenu
PopUpMenuSelect
SystemMenu
SystemEdit

Previous Book Contents Book Index Next

© Apple Computer, Inc.
11 JUL 1996