home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 5 / 05.iso / a / a054 / 1.img / GETLIB.EXE / GETGOTO.PRG < prev    next >
Encoding:
Text File  |  1992-03-09  |  1.6 KB  |  78 lines

  1. // GetGoTo.prg
  2. //
  3. // Get reader implementing GOTO GET
  4.  
  5. #include "GetExit.ch"
  6.  
  7. MEMVAR GetList
  8.  
  9. proc GetMoveReader( oGet )
  10.  
  11. LOCAL nCurrentGet
  12.  
  13.   nCurrentGet := Ascan(GetList, {|o| o == oGet })
  14.   IF !(GetMovingTo() == NIL) .AND. nCurrentGet != GetMovingTo()
  15.     IF nCurrentGet > GetMovingTo()
  16.       oGet:exitState := GE_UP
  17.     ELSE
  18.       oGet:exitState := GE_DOWN
  19.     ENDIF
  20.   ELSE
  21.     GetMovingTo(NIL) 
  22.     // read the GET if the WHEN condition is satisfied
  23.     IF ( GetPreValidate(oGet) )
  24.       // activate the GET for reading
  25.       oGet:SetFocus()
  26.  
  27.       DO WHILE ( oGet:exitState == GE_NOEXIT )
  28.         // check for initial typeout (no editable positions)
  29.         IF ( oGet:typeOut )
  30.           oGet:exitState := GE_ENTER
  31.         ENDIF
  32.  
  33.         // apply keystrokes until exit
  34.         DO WHILE ( oGet:exitState == GE_NOEXIT )
  35.           GetApplyKey(oGet, InKey(0))
  36.         ENDDO
  37.  
  38.         // disallow exit if the VALID condition is not satisfied
  39.         IF ( !GetPostValidate(oGet) )
  40.           oGet:exitState := GE_NOEXIT
  41.         ENDIF
  42.       ENDDO
  43.  
  44.       // de-activate the GET
  45.       oGet:KillFocus()
  46.     ENDIF
  47.   ENDIF
  48.  
  49. RETURN
  50.  
  51.  
  52. FUNCTION GoToGet(n)
  53.  
  54. LOCAL oGetCurrent := GetActive()
  55. LOCAL nGetCurrent := Ascan(GetList, {|o| o == oGetCurrent})
  56.  
  57.   IF nGetCurrent > n
  58.     oGetCurrent:exitState := GE_UP
  59.   ELSE
  60.     oGetCurrent:exitState := GE_DOWN
  61.   ENDIF
  62.   GetMovingTo(n)
  63.  
  64. RETURN NIL
  65.  
  66.  
  67. FUNCTION GetMovingTo(n)
  68.  
  69. STATIC nWhereToGo
  70. LOCAL  nOldWhereGo := nWhereToGo
  71.  
  72.   IF Pcount() > 0
  73.     nWhereToGo := n
  74.   ENDIF
  75.  
  76. RETURN nOldWhereGo
  77.  
  78.