home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 5 / 05.iso / a / a075 / 1.img / TOOLKIT1.EXE / SST916.PRG < prev    next >
Encoding:
Text File  |  1989-10-02  |  4.0 KB  |  161 lines

  1. ********************
  2.  
  3. PROCEDURE Onhelp
  4.  
  5.    PARAMETERS phelp, lhelp, vhelp
  6.  
  7.    IF PCOUNT() != 3
  8.    ELSE
  9.       IF TYPE(vhelp) = "A" && Is the variable of ARRAY type?
  10.            vhelp = vhelp + TRANSFORM(ROW(),"99") + ;
  11.                            TRANSFORM(COL(), "99")
  12.       ENDIF
  13.    ENDIF
  14.  
  15.    PRIVATE _hrow, _hcol, _return, _tempscr, _helpdemo
  16.  
  17.    scrcursor = IF( TYPE("scrcursor") = "U", .T., scrcursor)
  18.    scrhname  = IF( TYPE("scrhname")  = "U", "INHELP", scrhname)
  19.    scrprog   = IF( TYPE("scrprog")   = "U", "C:", scrprog)
  20.  
  21.    Setkeyoff()
  22.  
  23.    SET SCOREBOARD OFF
  24.    SET FUNCTION 10 TO CHR(23)
  25.  
  26.    withtopic = .F.
  27.    syscolor = SETCOLOR()
  28.    _helpdemo = (PCOUNT() = 2)   && No ESC key for the DEMOS
  29.  
  30.    * Test for error conditions...
  31.    IF !FILE(scrprog + "\" + scrhname + ".DBF")   && No Help File
  32.       Showerror(1)
  33.    ELSE
  34.       _hrow = ROW()
  35.       _hcol = COL()
  36.       _return = SELECT()
  37.       _tempscr = ""
  38.       IF PCOUNT() = 3
  39.          SELECT 0
  40.          USE (scrprog + "\" + scrhname) INDEX (scrprog + "\" + scrhname) ALIAS Help
  41.          search = SUBSTR(phelp,1,10) + SUBSTR(vhelp,1,10) + ;
  42.                   TRANSFORM(lhelp, "9999")
  43.          SEEK search           && see if the item is there to begin with!
  44.          context = FOUND()
  45.          withtopic = .F.
  46.          IF !context             && If context help is not there, assume 
  47.             SEEK "START HERE"    && (yes, assume) that there may be topic 
  48.             withtopic = FOUND()  && oriented help.
  49.             GO TOP
  50.          ENDIF
  51.       ELSE
  52.          * assume the help system is already open
  53.          search = phelp
  54.       ENDIF
  55.  
  56.       IF withtopic
  57.  
  58.          Topichelp()
  59.  
  60.       ELSE
  61.          SEEK search
  62.          IF FOUND()
  63.             Disp_help()
  64.          ELSE
  65.             Showerror(2)
  66.          ENDIF
  67.       ENDIF
  68.  
  69.       IF PCOUNT() = 3
  70.          USE
  71.          SELECT (_return)
  72.       ENDIF
  73.       SETCOLOR( syscolor )
  74.       @ _hrow, _hcol SAY ""
  75.    ENDIF
  76.  
  77.    SET CURSOR (scrcursor)
  78.    Setkeyon()
  79.  
  80. *********************
  81.  
  82. PROCEDURE Showerror
  83.  
  84.    PARAMETER errorway
  85.  
  86.    PRIVATE _errorscr, _errorcol
  87.  
  88.    _errorcol = SETCOLOR()
  89.    SETCOLOR(IF( ISCOLOR(), "W/R, I/I", "N/W, W/N" ))
  90.  
  91.    Windowpush( 0,0, 4,79 )
  92.  
  93.    IF errorway = 1
  94.       * The file did not exist
  95.       @    1,13 SAY "The data file for the Help System "+;
  96.                    "could NOT be found!"
  97.    ELSEIF errorway = 2
  98.       * The Item could NOT be found
  99.       @    1,13 SAY "There is no help item for this part "+;
  100.                    "of the program!"  
  101.    ELSE
  102.       * Undefined as of yet
  103.    ENDIF
  104.  
  105.    IF TYPE("INHELP()") == "UI"
  106.       @ 2,13 SAY " Press Ctrl F1 to create and build " +;
  107.                 "your help system!"
  108.       @ 3,13 SAY "             Press Any key to continue!"
  109.    ELSE   
  110.       @ 2,13 SAY "The necessary module to build that " + ;
  111.                 "file is NOT present"
  112.       @ 3,13 SAY "in your application.  " +;
  113.                 "Any key to return and continue.."
  114.    ENDIF
  115.  
  116.    INKEY(0)
  117.    SETCOLOR(_errorcol)
  118.    Windowpop()
  119.  
  120. *******************
  121.  
  122. PROCEDURE Disp_help
  123.  
  124.    SETCOLOR(TRIM(Help->helpcolor))
  125.    Windowpush(Help->top, Help->left, Help->bottom, Help->right)
  126.    IF DELETED()
  127.       @ Help->top, Help->left+2 SAY "< Deleted >"
  128.    ENDIF
  129.    SET CURSOR ON
  130.    @ Help->bottom, Help->left+1 SAY "< ESC to Quit >"
  131.    IF _helpdemo
  132.       KEYBOARD CHR(27)
  133.       MEMOEDIT( Help->helpscr, Help->top+1, ;
  134.                 Help->left+1, Help->bottom-1, ;
  135.                 Help->right-1,.F.)
  136.       INKEY(lhelp)
  137.    ELSE
  138.       MEMOEDIT( Help->helpscr, Help->top+1, ;
  139.                 Help->left+1, Help->bottom-1, ;
  140.                 Help->right-1,.F., "CAPTURE()")
  141.    ENDIF
  142.    Windowpop(Help->top, Help->left, ;
  143.              Help->bottom, Help->right)
  144.  
  145. ********************
  146.  
  147. FUNCTION Capture
  148.  
  149.    PARAMETERS p1, p2, p3
  150.  
  151.    wh = LASTKEY()
  152.    IF wh = 27
  153.       KEYBOARD CHR(27)
  154.       RETURN(0)
  155.    ELSEIF wh = 5 .OR. wh = 24 .OR. wh = 4 .OR. wh = 19 
  156.       RETURN(0)
  157.    ELSE
  158.       RETURN(32)
  159.    ENDIF
  160.  
  161.