home *** CD-ROM | disk | FTP | other *** search
- ********************
-
- PROCEDURE Onhelp
-
- PARAMETERS phelp, lhelp, vhelp
-
- IF PCOUNT() != 3
- ELSE
- IF TYPE(vhelp) = "A" && Is the variable of ARRAY type?
- vhelp = vhelp + TRANSFORM(ROW(),"99") + ;
- TRANSFORM(COL(), "99")
- ENDIF
- ENDIF
-
- PRIVATE _hrow, _hcol, _return, _tempscr, _helpdemo
-
- scrcursor = IF( TYPE("scrcursor") = "U", .T., scrcursor)
- scrhname = IF( TYPE("scrhname") = "U", "INHELP", scrhname)
- scrprog = IF( TYPE("scrprog") = "U", "C:", scrprog)
-
- Setkeyoff()
-
- SET SCOREBOARD OFF
- SET FUNCTION 10 TO CHR(23)
-
- withtopic = .F.
- syscolor = SETCOLOR()
- _helpdemo = (PCOUNT() = 2) && No ESC key for the DEMOS
-
- * Test for error conditions...
- IF !FILE(scrprog + "\" + scrhname + ".DBF") && No Help File
- Showerror(1)
- ELSE
- _hrow = ROW()
- _hcol = COL()
- _return = SELECT()
- _tempscr = ""
- IF PCOUNT() = 3
- SELECT 0
- USE (scrprog + "\" + scrhname) INDEX (scrprog + "\" + scrhname) ALIAS Help
- search = SUBSTR(phelp,1,10) + SUBSTR(vhelp,1,10) + ;
- TRANSFORM(lhelp, "9999")
- SEEK search && see if the item is there to begin with!
- context = FOUND()
- withtopic = .F.
- IF !context && If context help is not there, assume
- SEEK "START HERE" && (yes, assume) that there may be topic
- withtopic = FOUND() && oriented help.
- GO TOP
- ENDIF
- ELSE
- * assume the help system is already open
- search = phelp
- ENDIF
-
- IF withtopic
-
- Topichelp()
-
- ELSE
- SEEK search
- IF FOUND()
- Disp_help()
- ELSE
- Showerror(2)
- ENDIF
- ENDIF
-
- IF PCOUNT() = 3
- USE
- SELECT (_return)
- ENDIF
- SETCOLOR( syscolor )
- @ _hrow, _hcol SAY ""
- ENDIF
-
- SET CURSOR (scrcursor)
- Setkeyon()
-
- *********************
-
- PROCEDURE Showerror
-
- PARAMETER errorway
-
- PRIVATE _errorscr, _errorcol
-
- _errorcol = SETCOLOR()
- SETCOLOR(IF( ISCOLOR(), "W/R, I/I", "N/W, W/N" ))
-
- Windowpush( 0,0, 4,79 )
-
- IF errorway = 1
- * The file did not exist
- @ 1,13 SAY "The data file for the Help System "+;
- "could NOT be found!"
- ELSEIF errorway = 2
- * The Item could NOT be found
- @ 1,13 SAY "There is no help item for this part "+;
- "of the program!"
- ELSE
- * Undefined as of yet
- ENDIF
-
- IF TYPE("INHELP()") == "UI"
- @ 2,13 SAY " Press Ctrl F1 to create and build " +;
- "your help system!"
- @ 3,13 SAY " Press Any key to continue!"
- ELSE
- @ 2,13 SAY "The necessary module to build that " + ;
- "file is NOT present"
- @ 3,13 SAY "in your application. " +;
- "Any key to return and continue.."
- ENDIF
-
- INKEY(0)
- SETCOLOR(_errorcol)
- Windowpop()
-
- *******************
-
- PROCEDURE Disp_help
-
- SETCOLOR(TRIM(Help->helpcolor))
- Windowpush(Help->top, Help->left, Help->bottom, Help->right)
- IF DELETED()
- @ Help->top, Help->left+2 SAY "< Deleted >"
- ENDIF
- SET CURSOR ON
- @ Help->bottom, Help->left+1 SAY "< ESC to Quit >"
- IF _helpdemo
- KEYBOARD CHR(27)
- MEMOEDIT( Help->helpscr, Help->top+1, ;
- Help->left+1, Help->bottom-1, ;
- Help->right-1,.F.)
- INKEY(lhelp)
- ELSE
- MEMOEDIT( Help->helpscr, Help->top+1, ;
- Help->left+1, Help->bottom-1, ;
- Help->right-1,.F., "CAPTURE()")
- ENDIF
- Windowpop(Help->top, Help->left, ;
- Help->bottom, Help->right)
-
- ********************
-
- FUNCTION Capture
-
- PARAMETERS p1, p2, p3
-
- wh = LASTKEY()
- IF wh = 27
- KEYBOARD CHR(27)
- RETURN(0)
- ELSEIF wh = 5 .OR. wh = 24 .OR. wh = 4 .OR. wh = 19
- RETURN(0)
- ELSE
- RETURN(32)
- ENDIF
-