Although Topic files contain the
actual "meat" of the Help information,
their sustenance will be unavailable to VB programmers
and thus to users unless you associate each
Topic file with its own unique Topic ID so that
VB programmers can set the HelpContextID property
of objects to point to the topics.
You associate Topic files with
unique Topic IDs by creating and including a
Topic ID mapping file (*.h) in your project
and then associating the Topic IDs with Topic
files already included in the project in the
[FILES] section. To accomplish this, take the
following steps:
STEP BY STEP
7.3 Associating Topic
Files With Topic IDs
1. Use a text editor to create
one or more mapping files (*.h). Each line of
the mapping file will define a constant name
for a Topic ID number with the format:
#define ConstName TopicIDValue
See Listing 7.3 for an example.
LISTING 7.3
SAMPLE TOPIC ID MAPPING FILE
#define IDH_GENDER 10
#define IDH_MARITALSTATUS 20
#define IDH_MEDICALINSURANCE 30
2. Specify the mapping file or files in the [MAP] section of the
*.hhp file. Do this in the HTML Help Workshop by following these steps:
-
Click the HTMLHelp API Information icon (the fourth Toolbar button from the top
on the vertical toolbar along the left of the HTML Workshop's main screen) to
bring up the HTMLHelp API Information dialog box (see Figure 7.20).
FIGURE 7.20 The HTML Help Workshop's HTMLHelp API Information tabbed dialog box.
-
On the Map tab of this dialog box, click the Header button to bring up the Include
File dialog box. Click the Browse button on this dialog box to browse and select
the header file that you created in the first step above (see Figure 7.21).
FIGURE 7.21 Including a Mapping Header file for Topic IDs with the Include File
dialog box from the Map tab of the HTMLHelp API Information dialog box.
-
Click the various OK buttons until you've returned to the main project screen
that will now have a [MAP] section (refer to Figure 7.14 in the section "The
HTML Project Header File").
3. In the [ALIAS] section of the
HTML Help Project file (*.hhp), associate constant
names from the mapping files with corresponding
Topic files named in the [FILES] section.
Do this in the HTML Help Workshop by following these steps:
-
Click the HTMLHelp API Information icon (the fourth Toolbar button from the top
on the vertical toolbar along the left of the HTML Workshop's main screen) to
bring up the HTMLHelp API Information dialog box (refer to Figure 7.20).
-
On the Alias tab of this dialog box, click the Add button to bring up the Alias dialog
box (see Figure 7.22).
-
In the first field of the Alias dialog box, enter the name of a constant from one
of the mapping files that you created in the first step above (refer to Figure 7.22).
-
In the second field of the Alias dialog box, use the drop-down list to select the
topic file that you wish to associate with this constant's ContextID, as shown
in Figure 7.22. Add a comment if you wish and click OK.
FIGURE 7.22 The Alias dialog box on
the HTMLHelp API Information tabbed dialog
box with completed information for a Topic
file mapping.
-
Repeat the previous three steps for all the Topic IDs that you want to define. Then
click the various OK buttons until you've returned to the main project screen that
will now have an [ALIAS] section, as shown in Figure 7.14.
Figure 7.14 in the section "The
HTML Project Header File" shows the project file with a [MAP] section
that points to the mapping file, and an [ALIAS] section associating Topic ID constant
names with Topic files.
If an HTML Help file contained the information shown in Figure
7.14 in the section "The HTML Project Header
File" and the mapping file contained the information shown in Listing
7.3, then the VB programmer using this file could use a HelpContextID property
value of 1 to associate an object with the information in the gender.htm Topic
file.