Important: The information in this document is obsolete and should not be used for new development.
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 theMenuSelect
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 thePopUpMenuSelect
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
andMenuKey
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 theHiliteMenu
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
andMenuKey
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 theMenuChoice
function to return the menu ID and menu item of the disabled menu command.Your application should adjust its menus before calling
MenuSelect
orMenuKey
. 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