home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 10 / 10.iso / l / l391_1 / 2.ddi / HELPDEMO.TX$ / HELPDEMO.bin
Encoding:
Text File  |  1992-08-19  |  15.6 KB  |  462 lines

  1. .TOPIC:
  2. Contents
  3. The Visual Basic for MS-DOS Help Toolkit makes it easy to add
  4. hypertext Help to your applications.  The text you are reading
  5. now is a Helpfile.  The Help Toolkit is written entirely in
  6. Visual Basic and can be modified.  Help files are standard ASCII
  7. files that can be edited with most text editors and even by
  8. Visual Basic itself.
  9.  
  10. Click the mouse over one of the topics below for more
  11. information.  Or press TAB to select a topic then press ENTER
  12. to jump to it.
  13.  
  14. Creating and Editing Help files
  15. Adding Help to Your Applications
  16. Using Help
  17. Customizing the Help Toolkit
  18. .TOPIC:
  19. Creating and Editing Help Files
  20. To create a new Help file:
  21.  
  22. 1.  Determine which topics a user might want Help with.
  23. 2.  Start any text editor that reads and writes ASCII files.
  24. 3.  Create a topic named Contents and type a table of
  25.     contents below.  See Creating and Editing Topics.
  26.     Note that the Contents command button will not work
  27.     correctly unless you include a topic named Contents.
  28. 4.  Every entry in the table of contents should be a link
  29.     to a Help topic.  See Creating Links
  30. 5.  Create a Help topic for every link in the table of
  31.     contents.  See Creating and Editing Topics
  32. 6.  Every Help topic can contain links to other Help topics.
  33. 7.  Help topics do not need to be listed in the table of
  34.     contents.
  35.  
  36. To edit an existing Help file:
  37. NOTE:  The Help Toolkit cannot access Microsoft .HLP files.
  38.  
  39. 1.  Open the Help file in a text editor that reads and writes
  40.     ASCII files.
  41. 2.  Modify Links and Topics as described above.
  42.  
  43. See Example Help File
  44. .TOPIC:
  45. Creating and Editing Topics
  46. The Help Toolkit distinguishes Help topics from ordinary
  47. text by requiring that all topics are formatted in a
  48. specific way.
  49.  
  50. 1.  The word TOPIC must be on a line by itself, preceeded
  51.     by a period (.) and followed by a colon (:).  TOPIC
  52.     must be in uppercase.
  53. 2.  The period must be the first character on the line.
  54. 3.  Only spaces are allowed after the colon.
  55. 4.  The name of the topic itself must be on the line
  56.     immediately below the .TOPIC: statement.
  57. 5.  The topic text should begin on the line after the
  58.     name of the topic.
  59. 6.  The Help Toolkit will not word wrap text.  Use the
  60.     ENTER key to break text into reasonable length lines.
  61.     64 character lines work well because the Help window
  62.     defaults to 66 characters wide.
  63. 7.  The next topic should begin immediately after the last
  64.     line of the current topic.
  65.  
  66. For example, the following would be a valid topic except
  67. that the period is the second character on the line not the
  68. first.
  69.  
  70.  .TOPIC:
  71. This is a help topic name
  72. This is the first line a Help topic.
  73. .
  74. .
  75. .
  76. .
  77. This is the last line of a Help topic.
  78.  
  79. See Creating Links   Example Help File
  80. .TOPIC:
  81. Creating Links
  82. Links are hot spots that a Help user clicks on to jump
  83. to a Help topic.  Links are ordinary text surrounded by
  84. special triangle characters (ASCII codes 16 and 17).
  85.  
  86. Links and Topics must have exactly the same name or the
  87. Help Toolkit will not be able to find a Topic when a Link
  88. is clicked.
  89.  
  90. For example, click on Valid Help Topic to see how Links
  91. jump to new Topics.  And click on Invalid Help Topic to
  92. see what happens if you create a Link without a matching
  93. Topic.
  94.  
  95. See Creating and Editing Topics
  96. .TOPIC:
  97. Adding Help to Your Applications
  98. Necessary Files
  99. ---------------
  100. You must add the following files to your project to use
  101. the Help Toolkit:
  102.  
  103. 1.  HELP.BAS
  104. 2.  HELPF.FRM
  105. 3.  HELPUTIL.FRM
  106.  
  107. All files that call Help Toolkit routines must also have
  108. the following statement at the module level:
  109.  
  110. '$INCLUDE: 'HELP.BI'
  111.  
  112. Calling Help Toolkit Routines
  113. -----------------------------
  114. Required Steps:
  115.  
  116. 1.  Initialize the Help system by calling the
  117. HelpRegister <HelpFileName$> procedure.  You should do this
  118. when your application starts.
  119.  
  120. 2.  Display Help topics or the table of contents by
  121. calling HelpShowTopic <HelpTopicName$>.  HelpTopicName$
  122. should be "Contents" to show the table of contents.
  123.  
  124. 3.  Call HelpClose just before your application ends.
  125. NOTE:  You must call HelpClose during a Form_Unload
  126. event if your application ends when the last form is
  127. closed rather than by executing an END statement.
  128. Your application will not end if you fail to do this
  129. because frmHelpMain is still LOADED although invisible.
  130.  
  131. Optional:
  132. 1.  Call HelpSetOptions to set Help colors and show/hide
  133. specific Help command buttons after you call HelpRegister.
  134. See Help Toolkit Procedures for details.
  135.  
  136. 2.  Call HelpSearch to open Help's Search dialog.  Many
  137. applications have a Search item under their Help menu.
  138.  
  139. See Example Help Toolkit Application and
  140.     Help Toolkit Procedures for detailed information.
  141. .TOPIC:
  142. Valid Help Topic
  143. You jumped to this topic by clicking the Valid Help Topic
  144. link.
  145.  
  146. Click ---> Creating Links or choose the Back command button
  147. to return.
  148. .TOPIC:
  149. Customizing the Help Toolkit
  150. You can add or remove functionality from the Help Toolkit
  151. by changing the code in the following files:
  152.  
  153. 1.  HELP.BAS
  154. 2.  HELPF.FRM
  155. 3.  HELPUTIL.FRM
  156.  
  157. HELP.BAS contains all the application callable procedures
  158. such as HelpShowTopic and HelpRegister.
  159.  
  160. HELPF.FRM is the main Help form.  It contains the code
  161. required to display and scroll through Help topics.  It
  162. also has the code used to detect mouse clicks (to jump Links)
  163. and keyboard support.
  164.  
  165. HELPUTIL.FRM is a form that serves as the Search dialog, the
  166. History dialog, and the Copy dialog.  It is called from
  167. HELPF.FRM and HELP.BAS.  The look of the form is controlled
  168. entirely from the cmdButtonBar_Click routine in HELPF.FRM and
  169. the HelpSearch routine in HELP.BAS.
  170.  
  171. HELPF.FRM and HELP.BAS use the HELP.BI INCLUDE file.
  172.  
  173. See Adding Help to Your Applications
  174. .TOPIC:
  175. Example Help File
  176. The following is an example of a small Help file.  Note that
  177. real Help files must be flush left.  This example is indented
  178. one character to stop the Help Toolkit from processing .TOPIC:
  179. statements.  A real Help file would also have ASCII 16 and 17
  180. characters in place of the > and < symbols used below.
  181.  
  182.  .TOPIC:
  183.  Contents
  184.  Welcome to Bob's Accounting System version 7.1
  185.  
  186.  <Introduction>
  187.  <Adding New Accounts>
  188.  <Ordering Additional Modules>
  189.  .TOPIC:
  190.  Introduction
  191.  Bob's Accounting System is specificially designed for small
  192.  business accounting.  It includes modules for <Accounts Payable>
  193.  and <Accounts Receivable>.  Other modules may be purchased
  194.  seperately.  See <Ordering Additional Modules>
  195.  .TOPIC:
  196.  Adding New Accounts
  197.  Choose New from the Accounts menu.
  198.  You can also press F8.
  199.  
  200.  Note that Bob's Accounting System can store as many accounts
  201.  as disk space allows.
  202.  .TOPIC:
  203.  Accounts Payable
  204.  Access the A/P module through the Payables menu.
  205.  
  206.  Note that A/P entries are automatially added to the general
  207.  ledger when you exit Bob's Accounting System.
  208.  
  209.  See <Accounts Receivable>
  210.  .TOPIC:
  211.  Accounts Receivable
  212.  Access the A/P module through the Receievables menu.
  213.  
  214.  Note that A/R entries are automatially added to the general
  215.  ledger when you exit Bob's Accounting System.
  216.  
  217.  See <Accounts Payable>
  218.  .TOPIC:
  219.  Ordering Additional Modules
  220.  You can call (123) 555-5555 between 9 am and 5 pm to
  221.  inquire about new modules.  New modules such as tax, benefits,
  222.  and inventory are scheduled to be ready later this year.
  223.  
  224. See Creating and Editing Help files
  225. .TOPIC:
  226. Example Help Toolkit Application
  227. The following shows how the Help Toolkit procedures should be
  228. added to an application.  Assume the application is one form
  229. with menu controls for Help|Contents, Help|Search, and
  230. Help|Using Help.  It also has a Text control named txtFileName
  231. and a check box named ckReadOnly.
  232.  
  233. ' Module-level
  234. '$INCLUDE: 'HELP.BI'
  235. DIM SHARED HelpLoaded%
  236.  
  237. SUB Form_Load ()
  238.     HelpRegister "MYHELP.TXT" , HelpLoaded%
  239.  
  240.     ' HelpLoaded% is set to TRUE (-1) if HelpRegister
  241.     ' was successful or to FALSE (0) if it failed.
  242.     IF HelpLoaded% = FALSE THEN
  243.         ' Ensure that Help menu choices cannot
  244.         ' be selected.
  245.         mnuHelpContents.Enabled = 0
  246.         mnuHelpSearch.Enabled = 0
  247.         mnuHelpUsingHelp.Enabled = 0
  248.     END IF
  249. END SUB
  250.  
  251. SUB Form_Unload ()
  252.     HelpClose
  253. END SUB
  254.  
  255. SUB mnuHelpContents_Click ()
  256.     HelpShowTopic "Contents"
  257. END SUB
  258.  
  259. SUB mnuHelpSearch_Click ()
  260.     HelpSearch
  261. END SUB
  262.  
  263. SUB mnuHelpUsingHelp_Click ()
  264.     HelpShowTopic "Using Help"
  265. END SUB
  266.  
  267. SUB txtFileName_KeyUp (KeyCode AS INTEGER, Shift AS INTEGER)
  268.     IF KeyCode = 112 AND HelpLoaded% THEN 'F1 Key
  269.         HelpShowTopic "File Name"
  270.     END IF
  271. END SUB
  272.  
  273. SUB ckReadOnly_KeyUp (KeyCode AS INTEGER, Shift AS INTEGER)
  274.     IF KeyCode = 112 AND HelpLoaded% THEN 'F1 Key
  275.         HelpShowTopic "Read Only"
  276.     END IF
  277. END SUB
  278.  
  279. See Adding Help to Your Applications
  280. .TOPIC:
  281. Using Help
  282. Note that the following text is appropriate for adding
  283. to your own Help files.  A user should be able to access
  284. Using Help from the Help menu in your application.
  285.  
  286. See Example Help Toolkit Application
  287. ============================================================
  288.  
  289. Selecting a Help link:
  290. ----------------------
  291. With a mouse - click on phrases outlined by two triangles.
  292. With the keyboard - Press TAB or Shift-TAB to select a link.
  293.    Press ENTER to jump to that topic.
  294.  
  295. Scrolling the Help window:
  296. --------------------------
  297. With a mouse - click on the horizontal or vertical scroll
  298.    bars.
  299. With the keyboard - press the cursor navigation keys.
  300.  
  301. Closing the Help window:
  302. ------------------------
  303. With a mouse - double click on the window's control box icon.
  304. With the keyboard - press Ctrl-F4.
  305.  
  306. Command Buttons:
  307. ----------------
  308. Applications may use one or more of the following command
  309. buttons.  Use a mouse to click a button or press the letter
  310. mentioned below.
  311.  
  312. Contents - displays a table of contents for the application's
  313.    Help.  Press C to select Contents.
  314.  
  315. Search -  opens a dialog box that lists all available Help
  316.    topics.  Select a topic from the list box and press ENTER.
  317.    Press S to select Search.
  318.  
  319. Back - jumps to the last Help topic viewed. Press B to select
  320.     Back.
  321.  
  322. History - lists the last 20 Help topics viewed.  Jump to a
  323.     topic by selecting from the list box and pressing ENTER.
  324.     Press T to select History.
  325.  
  326. Copy - Copies the contents of the current Help topic into
  327.    an edit area.  Select the text you want copied to the
  328.    Clipboard and choose Copy.  Choosing Copy without selecting
  329.    any text in the edit area copies the entire Help topic to
  330.    the Clipboard.
  331.    Press P to select Copy.
  332. .TOPIC:
  333. Help Toolkit Procedures
  334. Five procedures in HELP.BAS give you access to all of
  335. Help Toolkit functions.
  336.  
  337. HelpRegister <HelpFileName$> , Success%
  338. -----------------------------------------
  339. HelpRegister opens the requested Help file and searches for
  340. all Help topics.  The Help topics and their file positions
  341. are stored in an array for later use.  The file itself remains
  342. open until you call the HelpClose routine (below).
  343. HelpRegister is normally called at application initialization
  344. (e.g. Form_Load).
  345.  
  346. You must call HelpRegister before showing any Help topics.
  347.  
  348. HelpFileName$ is the name of the help file required by
  349. your application.  It can be any valid MS-DOS file name.
  350. You must include the appropriate extension (.HLP or .TXT
  351. for example).  Note that the Help Toolkit will NOT search
  352. your path for the file so it may be necessary to supply a
  353. fully qualified file name (e.g. "C:\MYAPP\MYHELP.TXT").
  354.  
  355. Success% will be set to TRUE if the Help file was
  356. successfully registered and to FALSE otherwise.  The Success%
  357. flag should be checked before making subsequent Help Toolkit
  358. calls to prevent run-time errors.
  359.  
  360. HelpShowTopic TopicName$
  361. ------------------------
  362. Calling HelpShowTopic with a valid TopicName$ causes the
  363. Help Toolkit to display the text for TopicName$.  The Help
  364. form will be restored to its former size and location if it
  365. is minimized when HelpShowTopic is called.
  366.  
  367. TopicName$ must be the name of a Help topic.  An error
  368. will occur if the Help Toolkit cannot find the TopicName$.
  369.  
  370. HelpRegister must be called before calling HelpShowTopic but
  371. it is not necessary to call HelpRegister before every
  372. HelpShowTopic.
  373.  
  374. HelpSearch
  375. ----------
  376. HelpSearch opens the Help Toolkit topic search dialog box.
  377. The Help form will display the selected topic unless the
  378. user chooses the Cancel button.
  379.  
  380. HelpRegister must be called before calling HelpSearch but it
  381. is not necessary to call HelpRegister before every HelpSearch.
  382.  
  383. HelpClose
  384. ---------
  385. HelpClose closes the Help file and UNLOADs the Help form.
  386. Call HelpClose before you end your application.  HelpClose
  387. should always be called when your application's last
  388. form is being unloaded.
  389.  
  390. HelpSetOptions BackColor%,ForeColor%,DialogBackColor%,DialogForeColor%,ButtonColor%,SelectColor%,Flags%
  391. ------------------------------------------------------------------------------------
  392. This is an optional routine that makes it easy to customize
  393. the look of the Help form.  You cannot call this procedure
  394. before you call HelpRegister.  The Help Tookit will use the
  395. default values listed below if you do not call this procedure.
  396.  
  397. BackColor% is a value between 0 and 15 that specifies the text
  398. background color on the Help form.  Default is 7 (gray).
  399.  
  400. ForeColor% is a value between 0 and 15 that specifies the text
  401. foreground color on the Help form.  Default is 0 (black).
  402.  
  403. DialogBackColor% is a value between 0 and 15 that specifies
  404. the background color of the Help dialog boxes (Search, History,
  405. and Copy).  Default is 7 (gray).
  406.  
  407. DialogForeColor% is a value between 0 and 15 that specifies
  408. the foreground color of the Help dialog boxes (Search, History,
  409. and Copy).  Default is 0 (black).
  410.  
  411. ButtonColor% is a value between 0 and 15 that specifies the
  412. command button background color on the Help form.
  413. Default is 7 (gray).
  414.  
  415. SelectColor% is a value between 0 and 15 that specifies the
  416. foreground color of Help links selected using the TAB key.
  417. Default is SCREEN.CONTROLPANEL(0) (AccessKey Color).
  418.  
  419. Flags% is a bit field that sets the VISIBLE status of the
  420. five command buttons and enables other Help Toolit options.
  421. Add the values below to show buttons and enable functions.
  422.  
  423.     Function               Value    Default
  424.     ---------------------  -----    -------
  425.     ESC Closes Help            1       0
  426.     UNLOAD Help at Form Close  2       0
  427.     No Contents Button         4       0
  428.     No Search Button           8       0
  429.     No Back Button            16       0
  430.     No History Button         32       0
  431.     No Copy Button            64       0
  432.  
  433.     For example, Flags = 65 would allow ESC to close Help
  434.     and hide the Copy button.
  435.     
  436.     Space is only reserved at the top frmHelpMain if at least
  437.     one button is visible.
  438.  
  439.     Buttons normally to the right of missing buttons
  440.     will shift to the left to fill gaps.
  441.  
  442.     The Help Toolkit will automatically call HelpRegister to
  443.     re-open the Help file if HelpShowTopic or HelpSearch is
  444.     called after the Help form has been unloaded.  This can
  445.     only happen if:
  446.         1.  Unload on Form Close is TRUE and the user closed
  447.             the Help form.  Or
  448.         2.  An error such as "Insufficient Memory to Display
  449.             Help" caused Help to close itself.
  450.     
  451.     Registering a Help file can take some time so Unload at
  452.     Form Close should be set to FALSE unless:
  453.         1.  The Help Toolkit is running standalone (as it is
  454.             now).  Setting Unload at Form Close to TRUE
  455.             allows the application to end when the Help
  456.             form is closed.
  457.         2.  Memory is extremely constrained.
  458.  
  459. See Adding Help to Your Applications and
  460.     Example Help Toolkit Application
  461.  
  462.