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

  1. (*========================== KPHELP.SRC ===============================
  2.  
  3.   This file is compiled to the file KPHELP.HKB. When F1 is selected
  4.   the following occurs:
  5.  
  6.      1] The topic !HELP is created.  If there is already a knowledge
  7.         base in memory, !HELP is appended to the end of the knowledge base.
  8.      2] The file  WIN.INI is checked for the line KPHELP=path where path is 
  9.         the path where the KnowledgePro is loaded. This line is written into
  10.         WIN.INI when KnowledgePro is installed.  The topic !HELPDIR is
  11.         created inside !HELP and is assigned the name of the path for its
  12.         value.  This is used in KPHELP to locate the text and index files.
  13.      3] KPHELP.HKB is loaded from the directory named in the WIN.INI file.
  14.         It is loaded into the topic !HELP.
  15.      4] !HELP is called and help is executed.
  16.  
  17.   KPHELP creates the help window and then executes a WAIT. The user can
  18.   select menu items or hypertext to access help. KPHELP runs until Quit 
  19.   is selected or the window is closed from the control menu.  When the 
  20.   window is closed, the help files are closed and a CONTINUE is given to 
  21.   cancel the WAIT. !HELP is then deleted from memory. 
  22.  
  23.   KPHELP reads hypertext from the file KPHELP.hlp.  Since this file is 
  24.   over 300K, it has been indexed to decrease access time.  The file was
  25.   indexed using the knowledge base INDEX.KB which is included with your
  26.   system.
  27.  
  28.   --------------- Changing KPHELP ----------
  29.  
  30.   Since all the code and text for KPHELP is provided, you can change it
  31.   to suit your own preference.  If you rename or change any of the file
  32.   shipped with the system be sure to save copies of the originals.
  33.  
  34.   1] Changing the text of KPHELP.  You may want to edit the existing
  35.      text of the help files to include information you find helpful. To
  36.      do this you will have to load the file KPHELP.hlp into a text editor
  37.      that will hold a 300+K file.  This file size cannot be edited in
  38.      the KnowledgePro editor.  Be sure to save the text file in straight
  39.      ASCII format.  The layout of the file is straightforward and will
  40.      be obvious when you look at the file.  The format is described in
  41.      both INDEX.KB and ENGINE.KB, a hypertext file reading engine.
  42.  
  43.      Once the file is created, it must be indexed using INDEX.KB. 
  44.      You can either use the file names KPHELP.Hlp and KPHELP.NDX or,
  45.      you can change the names of the files used in KPHELP.SRC.  If 
  46.      you change KPHELP.SRC it must be compiled to KPHELP.HKB before it
  47.      will run correctly.
  48.  
  49.   2] Changing the help knowledge base.  If you want to change the way
  50.      the help knowledge base runs, you can alter KPHELP.SRC and recompile
  51.      it to KPHELP.HKB.  If you want to use a new help knowledge base,
  52.      you can change the KPHELP=path\filename line in your WIN.INI file.
  53.      Reload Windows to read the new information from WIN.INI.
  54.      If you change the help knowledge base be sure to make all topic names
  55.      local so they will all be correctly removed from any knowledge base
  56.      which may be running in memory.
  57.  
  58.   3] Changing how the help knowledge base is called.  Whichever file is
  59.      named in the KPHELP=path\filename line of the WIN.INI file is
  60.      run whenever F1 is selected.  If you want to change the help
  61.      knowledge base so it can be run from the File/Run menu command
  62.      you should add the line   
  63.          !HELPDIR=path. 
  64.      where path is the name of the directory where the help files are 
  65.      located, to the first line of the knowledge base.  Next, re-compile
  66.      the knowledge base to KPHELP.HKB. 
  67.  
  68. ======================================================================== *)
  69. if element (system_info (), 3) < 8
  70.    then :w1 is window (Finish,5,2,83,23,,[PopUp,ThickFrame,MaximizeBox,ControlMenu,VertScroll,ShowChildren,Siblings],,,,close_event)
  71.    else :w1 is window (Finish,5,2,70,23,,[PopUp,ThickFrame,MaximizeBox,ControlMenu,VertScroll,ShowChildren,Siblings],,,,close_event).
  72. if last (system_info ()) > 2
  73.    then :font is oem_fixed_font and
  74.         :color is blue        
  75.    else :font is create_font ([12,8,400,'f','t','f',255,1,49,'Terminal']) and
  76.         :color is [].
  77. hyper_display (?color,,?font).
  78. use_font (oem_fixed_font).
  79. :format is ''.
  80. make_modal (?w1).
  81.  
  82. :m1 is menu ([&Top,&Functions,&Back,&Print,&Copy,&Quit,&Help],select).
  83. if string_copy (?!helpdir, string_length (?!helpdir), 1) <> '\'
  84.    then !helpdir is concat (?!helpdir,'\').
  85. :txtfile is concat (?!helpdir,'kphelp.hlp').
  86. :ndxfile is concat (?!helpdir,'kphelp.ndx').
  87. set_file_pos ([?txtFile,?ndxFile],0).
  88. :list is [].
  89. select:&Top ().
  90. show_window (?w1).
  91. wait ().
  92.   
  93. topic select (item).
  94.   do (?item).
  95.  
  96.   topic &Top.
  97.     disable_menu_item (?m1,©).
  98.     list is [].
  99.     set_title (,'KnowledgePro (Windows) Help'). 
  100.     text (#e,' 
  101.  Screen Interface:               Topics, OOP and Program Control: 
  102.     #mCreate Objects#m                 #mTopics#m     
  103.     #mManipulate Objects#m             #mObject-oriented Features#m 
  104.     #mUsing Text#m                     #mProgram Control#m 
  105.     #mGraphics#m                       #mBooleans, Rules and Arithmetic#m 
  106.     #mStyles for Windows#m 
  107.  
  108.  Files and External Resources:   Miscellaneous: 
  109.     #mExternal Files#m                 #mError Handling#m 
  110.     #mExternal Programs#m              #mDebugging#m 
  111.     #mUsing the Clipboard#m            #mSend Text to Printer#m 
  112.     #mDynamic Data Exchange#m          #mSystem Information#m 
  113.   
  114.  List, Strings and Conversion:  
  115.     #mLists#m 
  116.     #mStrings#m 
  117.     #mConversion between Lists and Strings#m 
  118.  
  119.  #mDescription of Events#m 
  120.  #mKnowledge Bases Included#m 
  121.  #mConverting from KnowledgePro (DOS) ver. 1.X#m ').
  122.   end.
  123.  
  124.   topic &Functions.
  125.     disable_menu_item (?m1,©).
  126.     list is [].
  127.     mark ('Alphabetic Listing of Functions').
  128.   end.
  129.  
  130.   topic &Back.
  131.     disable_menu_item (?m1,©).
  132.     list is remove (?list,last (?list)).
  133.     if ?list is []
  134.        then select:&top ()
  135.        else :item is last (?list) and
  136.             list is remove (?list,?item) and
  137.             mark (?item).
  138.   end. (* Back *)
  139.  
  140.   topic &Print.
  141.     print (get_text ()).
  142.   end.
  143.  
  144.   topic &Copy.
  145.     text_to_clipboard (?Format).
  146.   end.
  147.   
  148.   topic &Help.
  149.     disable_menu_item (?m1,©).
  150.     mark (Help).
  151.   end.
  152.   
  153.   topic &Quit.
  154.     close_window (?w1).
  155.   end. (* mQuit *)
  156.  
  157. end. (* select *)
  158.  
  159. topic Finish.
  160.   close ([?ndxfile,?txtfile]).
  161.   use_font (system_font).
  162.   continue ().
  163. end.
  164.  
  165. topic mark (item).
  166.   list gets (?item).    
  167.   disable_menu_item (?m1,©).
  168.   set_file_pos (?ndxfile,0).
  169.   :IndexInfo is read (?ndxfile,concat ('//',?item),'//').
  170.   set_file_pos (?txtfile, first (?IndexInfo)).
  171.   :t is read_char (?txtfile, element (?IndexInfo, 2)).
  172.   text (#e,?t). 
  173.   set_title (,?item).
  174. end. (* mark *)
  175.  
  176. topic 'This is the font for hypertext on the current monitor.'.
  177.  (* this topic prevents MARK from being called when the sample
  178.     hypertext is selected. *)
  179. end.