home *** CD-ROM | disk | FTP | other *** search
/ Shareware Overload / ShartewareOverload.cdr / windows / kpwdemo.zip / APPHELP.SRC < prev    next >
Text File  |  1990-06-28  |  4KB  |  118 lines

  1. (*============================= APPHELP.SRC =============================
  2.   
  3.    This KB can be used to read help files from within your application. It is used to create
  4.    the help file for the application DESIGN.  To use this in your application link the 
  5.    help option on your menu or a help button to a topic like this one:
  6.  
  7.          topic help.
  8.            load ('apphelp.src',temp).
  9.            temp:file is 'YOURAPP.hlp'.
  10.            temp ().
  11.            wait ().
  12.            remove_topic (temp).
  13.          end. 
  14.  
  15.    When the help topic is called APPHELP.SRC is loaded into the topic TEMP, the name
  16.     of the hypertext text file is passed and TEMP is executed.
  17.    
  18.    APPHELP is a hypertext engine which reads the text in the file passed as the value of
  19.    the topic TEMP:FILE.   The text file should be created in this format:
  20.  
  21.          //subject1
  22.          Here is the text for this subject.
  23.          Here is another line.
  24.  
  25.          //another subject
  26.          Spaces and line feeds          are used
  27.          in the file to format                the text.
  28.  
  29.     If your help file is so large that access times are slow, you may want to index the file.
  30.     Indexing is described in chapter 8 and in the knowledge base file INDEX.KB. 
  31.  
  32. ======================================================================= *)
  33.  
  34. (* all topics are created locally so they will be removed when the topic the KB is loaded
  35.     into is deleted *)
  36.  
  37. displayInfo ().
  38. :list is []. (* keeps track of what you have looked at so far. *)
  39.  
  40. if ?version is 3 then :width is 83 else :width is 70.
  41. :w1 is window (,5,2,?width,23,,[PopUp,ThickFrame,TitleBar,VertScroll,ShowChildren,Siblings,visible]).
  42. :m1 is menu ([&Top,&Back,&Print,&Quit,&Help],select).
  43. make_modal (?w1).
  44.  
  45. :message is read (?file,'//','//').  (* find the first screen of the help file *)
  46. close (?file).
  47. :top is string_replace (first (?message),'//').
  48. mark (?top).
  49.  
  50. topic select (item).
  51.   do (?item).
  52.  
  53.   topic &Top.
  54.     list is [].
  55.     mark (?top).
  56.   end.
  57.  
  58.   topic &Back.
  59.     list is remove (?list,last (?list)).
  60.     if ?list is []
  61.        then mark (?top)
  62.        else :item is last (?list) and
  63.             list is remove (?list,?item) and
  64.             mark (?item).
  65.   end. (* Back *)
  66.  
  67.   topic &Print.
  68.     print (get_text ()).
  69.   end.
  70.  
  71.   topic ©.
  72.     text_to_clipboard (?format).
  73.   end. (* mCopy *)
  74.   
  75.   topic &help.
  76.     text (#e,'
  77.     Reading Hypertext.
  78.  
  79.     The line below shows the font used for hypertext
  80.     on your monitor.
  81.  
  82.     #mThis is the font for hypertext on the current monitor.#m
  83.  
  84.     To select hypertext, point and click with the mouse
  85.     or, use TAB and SHIFT TAB to move the cursor among 
  86.     hypertext items and press ENTER to select the item.
  87.  
  88.     To go back to the previous screen, select BACK.
  89.     To return to the first screen, select TOP.
  90.     To print the current item, select PRINT.').
  91.     list gets help.
  92.  
  93.     topic 'This is the font for hypertext on the current monitor.'.
  94.       (* this is a dummy topic to catch the hypertext in the help screen.*)
  95.     end.
  96.  
  97.   end.
  98.   
  99.   topic &Quit.
  100.     close_window ().
  101.     continue ().
  102.   end. (* mQuit *)
  103.  
  104. end. (* select *)
  105.  
  106. topic mark (item).
  107.   list gets (?item).    
  108.   set_title (,?item).
  109.   text (#e,read (?file, concat ('//',?item),'//')).
  110.   close (?file).
  111. end. (* mark *)
  112.  
  113. topic displayInfo.
  114.   system is system_info ().
  115.   if last (?system) > 2
  116.      then hyper_display (blue).
  117.   version is string_copy (element (?system,9),1,1).
  118. end.