Adding Topics
When you are adding new topics, you don't add new topics to the boilerplate files that
were provided. Those files should stay untouched unless you want to change the
description of File, Open or other boilerplate topics. Instead, create a new file by
choosing File, New in Word and saving it in the hlp folder of the ShowString project
folder as ShowString.rtf. (Make sure to change the Save File As Type list box selection
to Rich Text Format.) If this were a large project, you could divide it up into several .rtf
files, but one will suffice for ShowString. In Developer Studio, open ShowString.hpj by
double-clicking it in the FileView tab and find the section headed [FILES]. Add this line
at the end of that section:
showstring.rtf
The Tools Menu Back in Word, switch to afxcore.rtf and copy the topic for the File
menu into the Clipboard; then switch back to ShowString.rtf and paste it in. (Don't
forget to include the page break after the topic in the selection when you copy.) Choose
View, Footnotes to display the footnotes, and Tools, Options, View tab, Hidden Text to
display the hidden text. Now you are going to edit the copied File topic to make it the
Tools topic. Change the footnotes first. They are as follows:
l The # footnote is the topic ID. The Help system uses this to find this topic from the
Contents page. Change it to menu_tools.
l The K footnote is the keyword entry. Although the Options dialog box probably
deserves several keywords, this menu does not, so remove that footnote by
selecting the letter K in the Help topic and pressing Delete. You must select the
letter; it isn't enough to click just before it. The footnote is deleted at the same
time.
l The $ footnote is the topic title. Change it to Tools menu commands.
In the topic, change File to Tools on the first two lines, and delete all the rows of the
table but one. Change the underlined text of that row to Options, the hidden text
immediately following to HID_TOOLS_OPTIONS, and the right column of that row to
Changes string, color, and centering. Figure 11.9 shows the way ShowString.rtf looks
in Word after these changes.
FIG. 11.9 Change the ShowString.rtf file to explain the new menu item.
TIP: If you can't remember the Help topic IDs your project is using, check
your .hm files. The ones added by Developer Studio, such as
HID_TOOLS_OPTIONS for the menu item with resource ID
ID_TOOLS_OPTIONS, are in ShowString.hm, whereas ShowStringx.hm
contains the Help topic IDs added by hand for context Help.
The Tools, Options Menu Item Switch back to afxcore, copy the File New topic, and
paste it into ShowString.rtf, as before. The topic and its footnotes are copied together.
Watch carefully to be sure you are working with the footnotes for the Tools Options
topic and not the ones for the Tools menu. Follow these steps:
1. Change the # footnote to HID_TOOLS_OPTIONS.
2. Change the K keyword. Several keywords should lead here, and each needs to
be separated from the next by a semicolon (;). Some need to be two-level keywords
with the levels separated by commas. A good first start is string, changing;color,
changing;centering, changing;appearance, controlling.
3. Change the $ keyword to Tools Options command.
4. Change the first line of the topic to Options command (Tools menu).
5. Delete the rest of the topic and replace it with a short description of this menu
item. The following text is okay:
Use this command to change the appearance of the ShowString
display with the Options dialog box. The string being displayed,
color of the text, and vertical and horizontal centering are
all controlled from this dialog.
If you want to test this, too, save the files in Word, compile the Help project, run
ShowString, and choose Tools. Highlight the Options item by moving the highlight with
the cursor keys, but don't click Options to select it; press F1 instead. Figure 11.10 shows
the Help window that displays.
FIG. 11.10 The new Tools Options Help is reached by pressing F1 while the item is highlighted on the
menu.
Each Control on the Options Dialog Copy the File New topic into ShowString.rtf
again and cut it down drastically. To do this, follow these steps:
1. Remove the K and $ footnotes.
2. Change the # footnote to HIDD_OPTIONS.
3. Change the first line to (Options dialog).
4. Delete the other text in the topic.
Copy this block into the Clipboard and paste it in seven more times so that you have a
skeleton for each control on the dialog box. Remember to copy the page break before or
after the topic, too. Then, edit each skeleton to document the following topic IDs:
l HIDD_OPTIONS_STRING
l HIDD_OPTIONS_BLACK
l HIDD_OPTIONS_RED
l HIDD_OPTIONS_GREEN
l HIDD_OPTIONS_HORIZCENTER
l HIDD_OPTIONS_VERTCENTER
l HIDD_OPTIONS_OK
l HIDD_OPTIONS_CANCEL
Change the topic ID and add a sentence or two of text. Be consistent. The examples
included with this chapter are each a single sentence that starts with an imperative
verb like Click or Select and ends with a period (.). If you would rather choose a different
style for your pop-up boxes, use the same style for all of them. It confuses the user when
pop-up boxes are inconsistent and tends to make them believe your coding is sloppy, too.
To test your work, compile ShowString.hpj again, run ShowString, and choose Tools,
Options. Click the Question button and then click somewhere on the dialog box. Explore
each of the controls to be sure you have entered the correct text. Figure 11.11 shows
the context Help for the String edit box.
FIG. 11.11 Display Help for a dialog box control by clicking the Question button in the upper-right
corner and then clicking a control.
Understanding Centering In ShowString.rtf, paste in another copy of the File New
topic. Make the following changes:
1. Change the # footnote to HID_CENTERING (the topic ID you added to
ShowStringx.hm and called in
CShowStringApp::OnHelpUnderstandingcentering()).
2. Change the K footnote to centering.
3. Change the $ footnote to Understanding Centering.
4. Change the title on the first line to Understanding Centering.
5. Replace the text with a short explanation of centering, like this:
ShowString can center the displayed string within the view. The two
options, "center horizontally" and "center vertically", can be set
independently on the Options dialog box, reached by choosing the
Options
item on the Tools menu. Text that is not centered horizontally is
displayed at the left edge of the window. Text that is not centered
vertically is displayed at the top of the window.
6. Add links from the word Tools to the menu_tools topic and from the word
Options to HID_TOOLS_OPTIONS, as before. Remember to watch for extra spaces.
Test this change in the usual way, and when you choose Help, Understanding Centering
from the ShowString menus, you should see something like Figure 11.12. Try following
the links; you can use the Back button to return to the centering topic.
FIG. 11.12 Display a teaching Help topic by choosing it from the Help menu.
No comments:
Post a Comment