home *** CD-ROM | disk | FTP | other *** search
/ Programmer 7500 / MAX_PROGRAMMERS.iso / CLIPPER / MISC / MAKEHELP.ZIP / MAKEHELP.DOC next >
Encoding:
Text File  |  1987-01-27  |  6.0 KB  |  111 lines

  1. .po 8
  2. .cw 10
  3.  
  4.  
  5.        MAKEHELP_-_A_Utility_to_Build_and_Maintain_Online_HELP_Messages
  6.                    Randy Richter               January 27, 1987
  7.  
  8. With the release of Nantucket Software's CLIPPER compiler, creation of a 
  9. context sensitive, fully interactive HELP capability for dBASE III 
  10. applications became an attainable reality for non-technical programmers.  
  11. Prior to this package, this capability was available in only 3 cases:
  12.  
  13.      o    if you modified the DOS keyboard processor to intercept a particular 
  14.           key sequence, then determine your specific location within an 
  15.           executing program (which calls for complex assembly language use);
  16.  
  17.      o    if you designed a HELP program written around dBASE's SET FUNCTION 
  18.           command, and initialized variables for program location at every 
  19.           input prompt (which requires a lot of extra coding to handle both 
  20.           calling the HELP program and restoring conditions in the original 
  21.           program on return);
  22.  
  23.      o    or if you purchased a separate package, compiled into a .COM file 
  24.           (or the like) executed from within your dBASE application.
  25.  
  26. CLIPPER provides a mechanism for making this context information available to 
  27. a HELP program or any other program: the SET KEY n TO progname command.  Once 
  28. SET, pressing key  'n' causes CLIPPER to load and execute module 'progname'.  
  29. It also passes three parameters:  the name of the program currently being 
  30. executed, the current source code line number, and the name of the variable 
  31. waiting for user input.  Once 'progname' finishes executing, control returns 
  32. to the original program at the last line number.
  33.  
  34. By default, CLIPPER sets key F1 (actually, key 28) to HELP.PRG.  If this 
  35. program has been linked into your program, HELP will automatically be run when 
  36. key F1 is pressed.  You can override this default and, for example, assign F10 
  37. to the HELP program with the command:
  38.           
  39.                          SET KEY -9 TO HELP
  40.  
  41. In this case, key F1 (key 28) will be available for another use.
  42.  
  43. Nantucket provides a sample HELP program in their documentation.  This program 
  44. has several major shortcomings:  
  45.  
  46.      o    Changing HELP messages will require recompiling and relinking your 
  47.           source code.  
  48.  
  49.      o    Printing messages can only be accomplished by printing a source code 
  50.           listing; this is not a format readily presentable to an end user.
  51.  
  52.      o    If HELP.PRG is compiled into your main program, the resulting size 
  53.           of your program may be too large to fit into memory in one piece.  
  54.           This would require you to use overlays.
  55. .pa
  56. .he MAKEHELP                          #                      January 27, 1987
  57. To resolve these difficulties, I wrote a different version of HELP.PRG, 
  58. included on this diskette.  This version stores help message in a memo field 
  59. (called HELP_MSG) linked to a particular variable (stored in the field named 
  60. HELP_VAR).  When F1 is pressed, the HELP program defines the current database 
  61. select area, opens area 9 for the HELP database, and searches that database 
  62. for the passed variable name.  If the variable is not found, a message is 
  63. displayed and control returns (after some housekeeping) to the calling 
  64. program.  If the variable is found (that is, if a help message has been 
  65. written for it), the message is displayed at the bottom of the screen using 
  66. CLIPPER's MEMOEDIT() command.  Use of MEMOEDIT is key to this routine.  It 
  67. allows the program author to provide as much HELP information as is desired, 
  68. while allowing the user to see as much or as little of the final message as is 
  69. needed (since MEMOEDIT allows for scrolling up and down through a memo field).
  70.  
  71. Once the user exits MEMOEDIT (by pressing either the F1 key again, or ESC and 
  72. answering 'Y' to the 'Abort edit' prompt), HELP selects the original database, 
  73. restores the original screen, and returns to the calling program.
  74.  
  75. This version of HELP does have some limitations.  In particular, it is not 
  76. fully context sensitive (unless you never use the same name for a variable in 
  77. two places - unlikely if you have separate add/delete/change routines).  If 
  78. this is a problem, the easiest solution is to modify the structure of the HELP 
  79. database to add the program name and/or line number of the different uses.  In 
  80. this case, you would also have to modify HELP.PRG to look for these variables 
  81. as well as HELP_VAR.
  82.  
  83. Maintaining your HELP files and messages is the function of MAKEHELP.PRG, 
  84. also included on this diskette.  This routine creates a unique help database 
  85. for your system (named 'xxxxxHLP', with 'xxxxx' replaced by your 1-to-5 
  86. character system acronym), and allows you to add, change, delete, view, or 
  87. print your messages.  MAKEHELP should not be included in your system's source 
  88. code; only HELP itself must be compiled and linked.
  89.  
  90. MAKEHELP makes extensive use of two CLIPPER 'extensions' to dBASE: its 
  91. treatment of memo fields as string variables, and its use of arrays.  These 
  92. are combined in the print routine (procedure SUBSTRING), where the memo fields 
  93. are truncated just before the phrase 'END OF MESSAGE', then placed into array 
  94. elements.  This last operation uses the MEMOTRAN function (written by 
  95. Nantucket) and the LAT function (written by me) to remove control characters, 
  96. and separate the memo field into separate elements broken at the end of whole 
  97. words.
  98.  
  99. There is one 'kludge' in the HELP procedure at the end of MAKEHELP:  this 
  100. version uses a procedure called SETCOLOR to set display colors.  This allows 
  101. HELP to determine the colors in use in the calling program, and restore them 
  102. once the help message has been displayed.  I'm currently looking for a way of 
  103. determining the current color setting in CLIPPER without resorting to this 
  104. klunky approach; any suggestions?
  105.  
  106. MAKEHELP and HELP are freely available for use within DOE applications.  
  107. No guarantees - but please let me know of any problems or suggestions.
  108.  
  109.  
  110.  
  111. ly available for use within D