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 Dialog-Item Help Resource

You can provide help balloons for individual items in a dialog box or an alert box by supplying a dialog-item help resource, which is a resource of type 'hdlg'. You specify different help balloons for various states of an item--by highlight value if the item is a control, and by enabled or disabled states for items that are not controls.

To associate an 'hdlg' resource with a particular alert box or dialog box, either you must include an item of type HelpItem in the box's item list ('DITL') resource, or you must create an 'hwin' resource. Listing 3-8 on page 3-55 shows how to use an item of type HelpItem--and Listing 3-10 on page 3-67 shows you how to use an 'hwin' resource--for associating an 'hdlg' resource with a particular alert box or dialog box. For detailed information about using an item of type HelpItem, see "Adding a Help Item to an Item List Resource" on page 3-57. For detailed information on using an 'hwin' resource, see "Associating Help Resources With Static Windows" on page 3-63.

All 'hdlg' resources must have resource IDs greater than 128.

The format of a Rez input file for an 'hdlg' resource differs from its compiled output form. This section describes the structure of a Rez-compiled 'hdlg' resource. If you are concerned only with creating 'hdlg' resources, see "Providing Help Balloons for Items in Dialog Boxes and Alert Boxes" on page 3-47 for a detailed description, using several code samples, of how to use Rez input files to create 'hdlg' resources.

An 'hdlg' resource consists of a header component, a missing-items component, and a variable number of dialog-item components. Figure 3-30 shows the general structure of a compiled 'hdlg' resource.

Figure 3-30 Structure of a compiled dialog-item help ('hdlg') resource

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

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

The structures of the missing-items component and the dialog-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 and the dialog-item components can each specify four different help messages:

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

Since they both adhere to the formats specified by the previously described identifiers, the missing-items component and the dialog-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-31 shows the structure of a component that stores its help messages as Pascal strings within the 'hdlg' resource itself.

Figure 3-31 Structure of an 'hdlg' component compiled with the HMStringItem identifier

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

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

Figure 3-32 Structure of an 'hdlg' component compiled with the HMStringResItem identifier

If you examine a compiled version of an 'hdlg' 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 and their index numbers follow. The text strings referenced by these pairs are used for the second, third, and fourth help messages, respectively.

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

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

If you examine a compiled version of an 'hdlg' 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-34 shows the structure of an 'hdlg' component that specifies no help messages.

Figure 3-34 Structure of an 'hdlg' component compiled with the HMSkipItem identifier

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


Previous Book Contents Book Index Next

© Apple Computer, Inc.
6 JUL 1996