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: More Macintosh Toolbox /
Chapter 3 - Help Manager / Help Manager Reference
Resources


The Menu Help Resource

To provide help balloons for a menu--pull-down, pop-up, or hierarchical--that uses the standard menu definition procedure, you can create a menu help resource. A menu help resource is a resource of type 'hmnu'; in it, you specify help balloons for the menu title and for each item in the menu. You create a separate 'hmnu' resource for each menu. All 'hmnu' resources must have resource IDs greater than 128.

The format of a Rez input file for an 'hmnu' resource differs from its compiled output form. This section describes the structure of a Rez-compiled 'hmnu' resource. If you are concerned only with creating 'hmnu' resources, see "Providing Help Balloons for Menus" beginning on page 3-24. That section gives a detailed description, using several code samples, of how to use Rez input files to create 'hmnu' resources.

An 'hmnu' resource consists of a header component, a missing-items component, a menu-title component, and a variable number of menu-item components. Figure 3-23 shows the general structure of a compiled 'hmnu' resource.

Figure 3-23 Structure of a compiled menu help ('hmnu') resource

If you examine a compiled version of an 'hmnu' resource, you find that the header component consists of the following elements:

The Help Manager identifies each component by its order in the resource. The missing-items component always follows the header component of an 'hmnu' resource. The menu-title component always follows the missing-items component. Then a variable number of menu-item components are stored in this resource. The Help Manager determines the end of the 'hmnu' resource by using the item count information in the header component.

The structures of the missing-items component, the menu-title component, and the menu-item components depend on identifiers specified inside the components. The identifiers used in a Rez input file are described in "Specifying the Format for Help Messages" on page 3-21.

The missing-items component, the menu-title component, and the menu-item components can each specify four different help messages:

An empty string or a resource ID of 0 for any messages in the menu-title or menu-item components causes the Help Manager to use the appropriate help message contained in the missing-items component.

Since they all adhere to the formats specified by the previously described identifiers, the missing-items component, the menu-title component, and the menu-item components can have similar structures. The Help Manager determines the end of a component by examining its length, which is stored in the first 2 bytes of the component.

Figure 3-24 shows the structure of a component that stores its help messages as Pascal strings within the 'hmnu' resource itself.

Figure 3-24 Structure of an 'hmnu' component compiled with the HMStringItem identifier

If you examine a compiled version of an 'hmnu' resource, you find that a component identified in a Rez input file by the HMStringItem identifier consists of the following elements:

Figure 3-25 shows the structure of an 'hmnu' component that specifies its help messages as text strings stored in string list ('STR#') resources.

Figure 3-25 Structure of an 'hmnu' component compiled with the HMStringResItem identifier

If you examine a compiled version of an 'hmnu' resource, you find that a component identified in a Rez input file by the HMStringResItem identifier consists of the following elements:

Three more pairs of resource IDs/index numbers follow. The text strings that these pairs refer to are used for the second, third, and fourth help messages, respectively.

Figure 3-26 shows the structure of an 'hmnu' component that specifies its help messages in picture ('PICT') resources, styled text ('TEXT' and 'styl') resources, or string ('STR ') resources.

Figure 3-26 Structure of an 'hmnu' component compiled with the HMPictItem, HMTEResItem, or HMSTRResItem identifier

If you examine a compiled version of an 'hmnu' resource, you find that a component identified in a Rez input file by either the HMPictItem, HMTEResItem, or HMSTRResItem identifier consists of the following elements:

Three more resource IDs follow; the Help Manager uses these resources (either 'PICT', 'TEXT' and 'styl', or 'STR ') for the second, third, and fourth help messages, respectively (as previously described).

Figure 3-27 shows the structure of an 'hmnu' component that specifies no help messages.

Figure 3-27 Structure of an 'hmnu' component compiled with the HMSkipItem identifier

If you examine a compiled version of an 'hmnu' resource, you find that a component identified by the HMSkipItem identifier consists of the following elements:

For menu-item components, two additional identifiers are available: HMCompareItem and HMNamedResourceItem. When the HMCompareItem identifier is specified, the Help Manager compares a string specified in the component against the current menu item. If the string matches the current menu item, the Help Manager uses the help messages specified in the rest of the component, shown in Figure 3-28. This type of component is useful for a menu item that can change names.

Figure 3-28 Structure of a menu-item component compiled with the HMCompareItem identifier

If you examine a compiled version of an 'hmnu' resource, you find that a component identified in a Rez input file by the HMCompareItem identifier consists of these elements:

When the identifier HMNamedResourceItem is specified, the Help Manager retrieves help messages from a resource that matches the name and state of the current menu item.

Figure 3-29 shows the format of a menu-item component that uses named resources for help messages.

Figure 3-29 Structure of a menu-item component compiled with the HMNamedResourceItem identifier

If you examine a compiled version of an 'hmnu' resource, you find that a component identified in a Rez input file by the HMNamedResourceItem identifier consists of these elements:


Previous Book Contents Book Index Next

© Apple Computer, Inc.
6 JUL 1996