⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 ch11.htm

📁 A very good resource on Visual C++ 6.0 environment. It teaches through step by step approach and fin
💻 HTM
📖 第 1 页 / 共 4 页
字号:
	<DD><B>21. </B>Skip the How To Modify Text topic for now and leave it unchanged.
	<P>
	<DT></DT>
	<DD><B>22. </B>Remove the final directive about tailoring the No Help Available messages
	to each message box (don't remove the two No Help Available topics).
	<P>
</DL>

<P>That completes the extensive changes required to the boilerplate afxcore.rtf file
generated by AppWizard. In the other boilerplate file, afxprint.rtf, scroll to the
bottom and remove the Page Setup topic.</P>
<P>Would you like to test all this work? Save afxcore.rtf and afxprint.rtf within
Word. Switch to Developer Studio and choose Build, Build to bring the project up
to date. Then open ShowString.hpj and choose Build, Compile. This pulls all the .rtf
files together into ShowString.hlp. Choose Build, Execute to run ShowString, and
choose Help, Help Topics from the ShowString menus. As you can see in Figure 11.8,
the Window menu topic is now substantially shorter. You can check that your other
changes have been made, as well.</P>
<P><A HREF="javascript:popUp('11fig08.gif')"><B>FIG. 11.8</B></A><B> </B><I>After
saving the .rtf files and compiling the Help project, you can test to see that your
changes have been made successfully.</I></P>
<P>
<H3><A NAME="Heading13"></A>Adding Topics</H3>
<P>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:</P>
<P>
<PRE>showstring.rtf
</PRE>
<P><B>The Tools Menu&#160;&#160;</B>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:</P>

<UL>
	<LI>The # footnote is the topic ID. The Help system uses this to find this topic
	from the Contents page. Change it to <B>menu_tools</B>.
	<P>
	<LI>The K footnote is the keyword entry. Although the Options dialog box probably
	deserves several keywords, this menu doesn't, so remove that footnote by selecting
	the letter <I>K</I> 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.
	<P>
	<LI>The $ footnote is the topic title. Change it to <B>Tools menu</B> <B>commands</B>.
</UL>

<P>In the topic, change File to <B>Tools</B> on the first two lines, and delete all
the rows of the table but one. Change the underlined text of that row to <B>Options</B>,
the hidden text immediately following to <B>HID_TOOLS_OPTIONS</B>, and the right
column of that row to <B>Changes string, color, and centering</B>. Figure 11.9 shows
the way ShowString.rtf looks in Word after these changes.</P>
<P><A HREF="javascript:popUp('11fig09.gif')"><B>FIG. 11.9</B></A><B> </B><I>Change
the ShowString.rtf file to explain the new menu item.</I></P>
<P>


<BLOCKQUOTE>
	<P>
<HR>
<strong>TIP:</strong> 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. 
<HR>


</BLOCKQUOTE>

<P><B>The Tools, Options Menu Item&#160;&#160;</B>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:</P>

<DL>
	<DT></DT>
	<DD><B>1. </B>Change the # footnote to <B>HID_TOOLS_OPTIONS</B>.
	<P>
	<DT></DT>
	<DD><B>2. </B>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 <B>string, changing;color,
	changing;centering, changing;appearance, controlling</B>.
	<P>
	<DT></DT>
	<DD><B>3. </B>Change the $ keyword to <B>Tools Options command</B>.
	<P>
	<DT></DT>
	<DD><B>4. </B>Change the first line of the topic to <B>Options command (Tools menu)</B>.
	<P>
	<DT></DT>
	<DD><B>5. </B>Delete the rest of the topic and replace it with a short description
	of this menu item. The following text is okay:
	<P>
</DL>

<PRE>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.
</PRE>
<P>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.</P>
<P><A HREF="javascript:popUp('11fig10.gif')"><B>FIG. 11.10</B></A><B> </B><I>The
new Tools Options Help is reached by pressing F1 while the item is highlighted on
the menu.</I></P>
<P><B>Each Control on the Options Dialog&#160;&#160;</B>Copy the File New topic into
ShowString.rtf again and cut it down drastically. To do this, follow these steps:</P>

<DL>
	<DT></DT>
	<DD><B>1. </B>Remove the K and $ footnotes.
	<P>
	<DT></DT>
	<DD><B>2. </B>Change the # footnote to <B>HIDD_OPTIONS</B>.
	<P>
	<DT></DT>
	<DD><B>3. </B>Change the first line to <B>(Options dialog)</B>.
	<P>
	<DT></DT>
	<DD><B>4. </B>Delete the other text in the topic.
	<P>
</DL>

<P>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:</P>

<UL>
	<LI>HIDD_OPTIONS_STRING
	<P>
	<LI>HIDD_OPTIONS_BLACK
	<P>
	<LI>HIDD_OPTIONS_RED
	<P>
	<LI>HIDD_OPTIONS_GREEN
	<P>
	<LI>HIDD_OPTIONS_HORIZCENTER
	<P>
	<LI>HIDD_OPTIONS_VERTCENTER
	<P>
	<LI>HIDD_OPTIONS_OK
	<P>
	<LI>HIDD_OPTIONS_CANCEL
</UL>

<P>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 <I>Click</I> or <I>Select</I> 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.</P>
<P>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.</P>
<P><A HREF="javascript:popUp('11fig11.gif')"><B>FIG. 11.11</B></A><B> </B><I>Display
Help for a dialog box control by clicking the Question button in the upper-right
corner and then clicking a control.</I></P>
<P><B>Understanding Centering&#160;&#160;</B>In ShowString.rtf, paste in another
copy of the File New topic. Make the following changes:</P>

<DL>
	<DT></DT>
	<DD><B>1. </B>Change the # footnote to <B>HID_CENTERING</B> (the topic ID you added
	to ShowStringx.hm and called in CShowStringApp::OnHelpUnderstandingcentering()).
	<P>
	<DT></DT>
	<DD><B>2. </B>Change the K footnote to <B>centering</B>.
	<P>
	<DT></DT>
	<DD><B>3. </B>Change the $ footnote to <B>Understanding Centering</B>.
	<P>
	<DT></DT>
	<DD><B>4. </B>Change the title on the first line to <B>Understanding Centering</B>.
	<P>
	<DT></DT>
	<DD><B>5. </B>Replace the text with a short explanation of centering, like this:
	<P>
</DL>

<PRE>ShowString can center the displayed string within the view. The two
options, &quot;center horizontally&quot; and &quot;center vertically&quot;, 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.
</PRE>

<DL>
	<DT></DT>
	<DD><B>6. </B>Add links from the word <I>Tools</I> to the menu_tools topic and from
	the word <I>Options</I> to HID_TOOLS_OPTIONS, as before. Remember to watch for extra
	spaces.
	<P>
</DL>

<P>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.</P>
<P><A HREF="javascript:popUp('11fig12.gif')"><B>FIG. 11.12</B></A><B> </B><I>Display
a teaching Help topic by choosing it from the Help menu.</I></P>
<P>
<H3><A NAME="Heading14"></A>Changing the How to Modify Text Topic</H3>
<P>AppWizard already provided a How to Modify Text topic at the bottom of afxcore.rtf
that needs to be edited to explain how ShowString works. It displays when the user
selects the view area for context Help. Replace the text with a much shorter explanation
that tells the user to choose Tools, Options. To add a link to that topic (short
though it is), type <B>HID_TOOLS_OPTIONS</B> immediately after the word <I>Options</I>
in the Help topic. While you're at it, type <B>menu_tools</B> immediately after the
word <I>Tools</I>. Select the word <I>Options</I> and press Ctrl+Shift+D to double-underline
it; then do the same for <I>Tools</I>. Select HID_TOOLS_OPTIONS and press Ctrl+Shift+H
to hide it; then do the same for menu_tools.</P>


<BLOCKQUOTE>
	<P>
<HR>
<strong>TIP:</strong> If you've reassigned these keys, you can do the formatting the long
	way. To double-underline text, select it and choose Format, Font. Drop down the Underline
	box and choose Double; then click OK. To hide text, select it and choose Format,
	Font; then select the Hidden box and click OK. 
<HR>
</P>
	<P>
<HR>
<strong>TIP:</strong> There can't be any spaces between the double-underlined text and the
	hidden text or at the end of the hidden text. Word can give you some trouble about
	this because the Smart Cut and Paste feature that works so nicely with words can
	insert extra spaces where you don't want them or can make it impossible to select
	only half a word. You can turn off the feature in Word by choosing Tools, Options,
	the Edit tab and by deselecting the When Selecting, Automatically Select Entire Word
	and Use Smart Cut and Paste check boxes. 
<HR>


</BLOCKQUOTE>

<P>Ready to test again? Save the files in Word, compile the Help project file, and
execute ShowString; then click the What's This? button on the toolbar and click in
the main view. Your new How to Modify Text entry should display.</P>
<P>
<H2><A NAME="Heading15"></A>Adjustments to the Contents</H2>
<P>This tiny little application is almost entirely documented now. You need to add
the Tools menu and Understanding Centering to the Contents and to check the index.
The easiest way to tackle the Contents is with Help Workshop. Close all the Help-related
files that are open in Developer Studio and Word and open Help Workshop by choosing
Start, Programs, Microsoft Visual Studio 6.0, Microsoft Visual Studio 6.0 Tools,
Help Workshop. Open ShowString.cnt by choosing File, Open and working your way through
the Open dialog box. (If you can't find the contents file, be sure to change the
File Type drop-down. It's probably in your Debug directory.) This is the Contents
file for ShowString.</P>
<P>In the first open book, click the View Menu item and then click the Add Below
button. (Alternatively, click the Window Menu item and then the Add Above button.)
The Edit Contents Tab Entry dialog box, shown in Figure 11.13, appears. Fill it in
as shown; by leaving the last two entries blank, the default Help File and Window
Type are used. Click OK.</P>
<P><A HREF="javascript:popUp('11fig13.gif')"><B>FIG. 11.13</B></A><B> </B><I>Add
entries to the Contents tab with Help Workshop's Edit Contents Tab Entry dialog box.</I></P>
<P>Click the placeholder book named &lt;&lt;add your application-specific topics
here&gt;&gt; and click Add Above again. When the Edit Contents Tab Entry dialog box
appears, select the Heading radio button from the list across the top. As shown in
Figure 11.14, you can change only the title here. Don't use Understanding Centering
because that's the title of the only topic under this heading. Enter <B>Displaying
a string</B> and click OK.</P>
<P>Add a topic below the new heading for Understanding Centering, whose ID is HID_CENTERING,
and remove the placeholder heading and topic. Save your changes, close Help Workshop,
compile ShowString.hpj in Developer Studio again, and test your Help. Choose Help,
Help Topics and expand each heading. You will see something like Figure 11.15.</P>
<P><A HREF="javascript:popUp('11fig14.gif')"><B>FIG. 11.14</B></A><B> </B><I>Add
headings to the Contents tab with Help Workshop's Edit Contents Tab Entry dialog
box.</I></P>
<P><A HREF="javascript:popUp('11fig15.gif')"><B>FIG. 11.15</B></A><B> </B><I>After
saving the .cnt file and compiling the .hpj file, display the new table of contents
by choosing Help, Help Topics.</I></P>
<P>While you have the Help Topics dialog box open, click the Index tab. Figure 11.16
shows how the K footnotes you entered throughout this section have all been added
to the index. If it looks a little sparse, you can always go to the .rtf files and
add more keywords, remembering to separate them with semicolons.</P>
<P><A HREF="javascript:popUp('11fig16.gif')"><B>FIG. 11.16</B></A><B> </B><I>The
index has been built from the K footnotes in the .rtf files.</I></P>
<P>Now the Help file for this application is complete, and you've arranged for the
relevant sections of the file to be displayed when the user requests online Help.
You can apply these concepts to your own application, and never again deliver an
undocumented product.</P>
<H1></H1>
<CENTER>
<P>
<HR>
<A HREF="ch10.htm" tppabs="http://www.fintech.ru/library/prog/SEUsingVC6/ch10/ch10.htm"><IMG SRC="previous.gif" tppabs="http://www.fintech.ru/library/prog/SEUsingVC6/button/previous.gif" WIDTH="128" HEIGHT="28"
ALIGN="BOTTOM" ALT="Previous chapter" BORDER="0"></A><A HREF="ch12.htm" tppabs="http://www.fintech.ru/library/prog/SEUsingVC6/ch12/ch12.htm"><IMG
SRC="next.gif" tppabs="http://www.fintech.ru/library/prog/SEUsingVC6/button/next.gif" WIDTH="128" HEIGHT="28" ALIGN="BOTTOM" ALT="Next chapter"
BORDER="0"></A><A HREF="index.htm" tppabs="http://www.fintech.ru/library/prog/SEUsingVC6/index.htm"><IMG SRC="contents.gif" tppabs="http://www.fintech.ru/library/prog/SEUsingVC6/button/contents.gif" WIDTH="128"
HEIGHT="28" ALIGN="BOTTOM" ALT="Contents" BORDER="0"></A> <BR>
</P>

<P>&#169; <A HREF="copy.htm" tppabs="http://www.fintech.ru/library/prog/SEUsingVC6/copy.htm">Copyright</A>, Macmillan Computer Publishing. All
rights reserved.
</CENTER>


</BODY>

</HTML>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -