Step 2 – Connecting a Help File to an AVR Application 57
You will probably want users to access your Help File from a Help Menu included
in your application. This involves creating the Menu controls by using Menu Editor,
then using the OSEXEC command to execute the help file, using WINHLP32,
specifying any additional parameters as needed.
If you want to call a particular topic from a Help button included on your form, you
use OSEXEC/EXEC, but you also need a pass a Winhlp32 parameter to identify
the individual topic in which you want to display.
The following is a listing of the WINHLP32 parameters.
winhlp32.exe [[-H] [-G[n]] [-W window-name] [-K keyword]
[-N context-num] [-I topic-id] [-P pop-up-id] HLP-
The following parameters may be used when starting Winhlp32:
Creates a configuration (.gid) file and quits. If a number is
specified, it determines which extensible tab to display by
default the first time the Help file is opened. A value of 1
would be the first tab beyond the Find tab.
Displays the Winhlp32.hlp Help file.
Displays the Help topic with the specified the topic ID.
Displays the topic identified by the specified keyword. The
keyword cannot contain any blanks.
Displays the topic specified by the context number (defined in
the [MAP] section of the project file).
Displays the specified pop-up topic. You must use the -P
switch in combination with the -I or -N switch, as shown in
the following examples:
WINHLP32 -P -I EXEC_WINHELP HCW.HLP
WINHLP32 -P -N 311 MYFILE.HLP
-W window-name Displays the topic in the specified window definition.
Specifies the Help file to display. If a name is not specified,
the File Open dialog box appears.
The following examples show how you would call a particular topic in a help file
from a help button using the Winhlp32 parameters in Caviar.
The following displays the help topic identified by Context number 12 (in the map
file) in "Myhelp".
OSEXEC "Winhlp32.exe -n12 Myhelp.hlp"
The following displays the help topic identified by the Keyword "Name” in
OSEXEC "Winhlp32.exe -kName Myhelp.hlp"
The following displays the help topic identified by the Topic ID called
"New_Customer_Information” in "Myhelp".
58 Palooza 2001 Help Labs
OSEXEC EXEC "Winhlp32.exe –INew_Customer_Information
The following examples show how to display the help topic identified by either a
Keyword or Topic ID in a Popup window in "Myhelp".
OSEXEC EXEC "Winhlp32.exe –P -KName Myhelp.hlp"
OSEXEC EXEC "Winhlp32.exe –P - INew_Customer_Information
If you will not be calling the help topic using a number from a map file (-n), and your
keyword(s) for the help topic have spaces, then you must either use the –I parameter, or
the CommonDialog control’s help properties.
Creating Context-Sensitive Help from an Application
So far, we have used AVR code to call an entire help file, and, by passing a
Winhlp32 parameter, we have called a particular topic within that help file.
In this section, we will adding Context-sensitive help to the IOFields. There are
basically only two steps you must perform within Visual RPG. There is no
additional coding that needs to be done.
Specify the name of the Help File created for the application in Project -
Assign the appropriate HelpContextID or HelpKey created in the Help file to
the desired fields using either the HelpContextID, HelpKey, or
Specifying the Help File for the Project
You must first tell the AVR application what the name and location of the Help file
for this application is. You specify the name of the Help file in Project - Project
Settings – Project tab.
To Specify a Help File for the Project
1. Select Project - Project S
In the Project tab, there is a field for you to enter the Help file name for the
2. Enter the help file name of Helpfile.hlp, or click the button to the right to
browse for the file.
Step 2 – Connecting a Help File to an AVR Application 59
pply and OK when finished.
Assigning Context-Sensitive Help in the Application
Once the help file is specified for the project, you are ready to begin using the
HelpContextID, HelpKey or WhatsThisHelp properties.
In this section, we are going to be using the HelpContextID and HelpKey
You call topics using the HelpContextID property by specifying an associated
‘MAP number’ that is contained in the .HH file.
You call topics using the HelpKey property by specifying an associated
‘Keyword’ for that topic.
Using the HelpContextID Property
To Use the HelpContextID Property
1. Open or view the MAP file assigned to the help file (Helpfile.HH). In this
section we will only be using the following map numbers.
2. Select the Cust No IOField and enter the number 2 into the HelpContextID
60 Palooza 2001 Help Labs
3. Select the rest of the IOFields and enter their corresponding Map number into
the HelpContextID property.
4. Run the application and press F1 into each of the IOFields. The following will
display when F1 is pressed in Cust No.
Note that Winhlp32 is launched, the entire Help Window is displayed, and
the Contents tab and topic are displaying the associated topic assigned to
that map number.
Using the HelpKey Property
If you do not want to generate a MAP file, you can use the HelpKey property. In the
HelpKey property, you enter a keyword string associated with that topic. Note that
you may have many keywords assigned to a topic, but you only need to specify one,
and it doesn’t matter which one, and blanks are accepted.
AVR looks at the HelpContextID property first (as long as WhatsThisHelp is not
enabled), so we also need to select the HelpContextID and enter 0.
To Use the HelpKey Property
1. Select the Cust No IOField and enter the keyword Cust No into the HelpKey
2. Select the HelpContextID property and enter a 0.
3. Enter the following Keywords for each of the following help topics.
Step 2 – Connecting a Help File to an AVR Application 61
4. Select the HelpContextID property and enter a 0 for each IOField.
5. Run the application and press F1 into each of the IOFields.
Note that when Winhlp32 is launched, the entire Help Window is
displayed, and the Contents tab and topic are displaying the associated
topic assigned to that keyword.
Enabling Secondary Windows
In Help files, there is one Main window. The Main window is the default window.
All topics automatically display in the Main window unless you specify otherwise.
You can create other custom windows called Secondary windows. You can specify
the appearance, and attributes, and options of the both windows to make it fit into
your overall Help system design.
A secondary window is specified by indicating a > sign followed by the name of the
secondary window to display, either within the help or when specifying the help file
Note that there is a secondary window enabled by default within any help file called
In this section, we will specify that the help topics display in a secondary window for
Note that secondary windows are only enabled for the HelpContextID and
HelpKey properties, and is ignored when using the WhatsThisHelpID property.
62 Palooza 2001 Help Labs
To Specify a Secondary Window for the Help Project’s
HelpContextID and HelpKey Properties
1. Go back into Project – Project Settings and specify the Secondary window
called “second’ by entering a >second after the name of the help file, as shown
2. Run the application.
3. Press F1 in Cust No.
4. Notice this time that the Help topic displays in a ‘smaller” window with the
specification set for the Secondary window in the help file as far as position,
size, options, and color, as shown below.
Even though Winhlp32 is launched, you do not see the “Contents” tab for the
help file. This is a convenient way to display the topics, since if the user
wants to view more information in the help file, they only need to select the
Also, the height of the secondary window automatically fits the size of the
text, so the window is smaller than displaying the text to the Main window.
Step 2 – Connecting a Help File to an AVR Application 63
Using the WhatsThisHelpID Button and Property
In this section, we will use the WhatsThisHelpID property and WhatsThisHelp
button to display context-sensitive help in a ‘popup’ window.
Note that if you want to use WhatsThisHelp popups, a MAP file must be
generated for the specified help file, as there is not a property to specify a
To Use the WhatsThisHelp Property
Be sure to specify the name of the help file for the application by selecting the
Project tab within Project – Project Settings.
Note that you can still leave the >Second after the help file to specify a
secondary window. It will not affect the displaying of WhatsThisHelp
popups, as it will be ignored.
Next, get the “whats this help” topic context-id numbers assigned to the help
topics from the help authoring person, or from the MAP file (.HH) that was
generated by the Help file.
The following are the Map numbers we will use in this section in conjunction
with the WhatsThisHelpID property.
Property Settings for the Form
There are several form properties that must be set to enable AVR to use
WhatsThisHelp, along with the WhatsThisHelp button. Click on the form,
and set the following properties as listed below.
Use 1, 2 or 3
Set to False
Set to False
Set to True
Set to True
4. Select the Cust No IOField and enter the number 9 into the WhatsThisHelpID
5. Select the rest of the IOFields and enter their corresponding Map number into
the WhatsThisHelpID property, as listed below.
64 Palooza 2001 Help Labs
6. Run the application.
7. Click on the WhatsThisHelp button in the Form’s Title Bar, then click in the
Cust No. IOField. The WhatsThisHelp topic for Cust No will display in a
popup window, as shown below.
Click on the other fields, and their corresponding information will display in a
Note that you can also select the F1 key in the IOField, and the
WhatsThisHelp popup will display as well.
Note that if the WhatsThisButton is used, the Form’s Minimize and Maximize
buttons are not enabled. You can still utilize the WhatsThisHelp popup
capability without using the WhatsThisHelp button. To do this, simply set the
WhatsThisButton button to false for the form, but keep WhatsThisHelp to
9. Click on the form and set the WhatsThisButton property for the Form to False
and set the MinButton and MaxButton properties to True.
Step 2 – Connecting a Help File to an AVR Application 65
10. Run the application again.
Notice that the Minimize and Maximize buttons are enabled, and that there is no
Help button. However, WhatsThisHelp is still enabled, so AVR will launch the
number in the WhatsThisHelpID properties when F1 is pressed, and will ignore
if there is an entry in the HelpContextID or HelpKey properties.
You have just completed the process to connect a Help file to an AVR
Continue with the next Step for the instructions to connect a WebHelp file to a
similar Web application.
66 Palooza 2001 Help Labs
This Page Intentionally Left Blank
Documents you may be interested
Documents you may be interested