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
Resources


The Menu Resource

You can provide descriptions of your menus in 'MENU' resources and use the GetMenu function or GetNewMBar function (if you also provide an 'MBAR' resource) to read in the descriptions of your menus. After reading in the resource description, the Menu Manager stores the information about specific menus in menu records.

WARNING
Menus in a resource must not be purgeable.
Figure 3-37 shows the format of a compiled 'MENU' resource. See Listing 3-1 on page 3-43 for a description of a 'MENU' resource in Rez input format.

Figure 3-37 Structure of a compiled menu ('MENU') resource

A compiled version of a 'MENU' resource contains the following elements:

If you use the standard menu definition procedure, your 'MENU' resource should describe the menu items in this manner. For each menu item, you need to provide its text, the icon number, the keyboard equivalent or other value ($1B to indicate the menu item has a submenu, $1C to indicate a script code other than the system script for the item's text, $1D to indicate the item's icon should be reduced, or $1E to indicate that an 'SICN' icon should be used), the marking character of the menu item or menu ID of the menu item's submenu, and the font style of the menu item's text. If an item doesn't have a particular characteristic, specify 0 for that characteristic. Figure 3-38 shows the variable-length data portion of a compiled 'MENU' resource that uses the standard menu definition procedure.

Figure 3-38 The variable-length data that describes menu items as defined by the standard menu definition procedure

The variable-length data portion of a compiled version of a 'MENU' resource that uses the standard menu definition procedure contains the following elements:

If you provide your own menu definition procedure, you should use the same format
for your resource descriptions of menus as shown in Figure 3-37. You can use the same format or a format of your choosing to describe menu items. You can also use bits 1-31
of the enableFlags field of the menu record as you choose; however, bit 0 must still indicate whether the menu is enabled or disabled.


Previous Book Contents Book Index Next

© Apple Computer, Inc.
11 JUL 1996