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


MenuChoice

If your application needs to find the item number of a disabled menu item that the
user attempted to choose, you can use the MenuChoice function to return the chosen menu item.

FUNCTION MenuChoice: LongInt; 
DESCRIPTION
If the user chooses a disabled menu item, the MenuChoice function returns a value that indicates which menu and menu item the user chose. The high-order word of the function result contains the menu ID of the menu, and the low-order word contains the item number of the menu item chosen by the user.

The MenuChoice function returns 0 as the low-order word of its function result if the mouse button was released while the cursor was in the menu bar or outside the menu.

SPECIAL CONSIDERATIONS
The Menu Manager updates the global variable MenuDisable whenever a menu is displayed. As the user moves the cursor over each item, the Menu Manager calls the menu definition procedure of the menu to update the MenuDisable global variable to reflect the current menu ID and menu item. The standard menu definition procedure updates the global variable MenuDisable appropriately. If your application uses its own menu definition procedure, your menu definition procedure should support this feature; if you use a menu definition procedure that does not update the global variable MenuDisable appropriately, the result returned by MenuChoice is undefined.


Previous Book Contents Book Index Next

© Apple Computer, Inc.
11 JUL 1996