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 / Adding Menus to and Removing Menus From the Current Menu List


InsertMenu

Use the InsertMenu procedure to insert an existing menu into the current menu list.

PROCEDURE InsertMenu (theMenu: MenuHandle; beforeID: Integer); 
theMenu
A handle to the menu record of the menu. The NewMenu and GetMenu functions return a handle to a menu record that you can use in this parameter.
beforeID
A number that indicates where in the current menu list the menu should be inserted. InsertMenu inserts the menu into the current menu list before the menu whose menu ID equals the number specified in the beforeID parameter. If the number in the beforeID parameter is 0 (or it isn't the ID of any menu in the menu list), InsertMenu adds the new menu after all others (except before the Help, Keyboard, and Application menus). If the menu is already in the current menu list or the menu list is already full, InsertMenu does nothing.
You can specify -1 for the beforeID parameter to insert a submenu into the current menu list. The submenus in the submenu portion of the menu list do not have to be currently associated with a hierarchical menu item; you can store submenus in the menu list and later specify that a menu item has a submenu if needed. However, note that the MenuKey function scans all menus in the menu list for keyboard equivalents, including submenus that are not associated with any menu item. You should not define keyboard equivalents for submenus that are in the current menu list but not associated with a menu item.
You can also specify -1 for the beforeID parameter to insert a pop-up menu into the current menu list. However, if you use the standard
pop-up control definition function, the pop-up control automatically inserts the menu into the current menu list according to the needs of the pop-up control.
DESCRIPTION
The InsertMenu procedure inserts into the current menu list the menu identified by the specified handle to a menu record. To update the menu bar to reflect the new menu, use DrawMenuBar.

SEE ALSO
For details on how to update your application's menu bar, see the description of DrawMenuBar on page 3-115.


Previous Book Contents Book Index Next

© Apple Computer, Inc.
11 JUL 1996