home *** CD-ROM | disk | FTP | other *** search
- /***
- * Gets20.prg
- */
-
- /***
- * GET - GOTO get
- *
- */
-
- #include "Getexit.ch"
- #include "Inkey.ch"
-
- #command READ ALLOWING MOVE ;
- => ;
- Aeval(GetList, ;
- {|o| o:Reader := {|o1| GetMoveReader(o1)} }) ;
- ; ReadModal(GetList); GetList := {}
-
- MEMVAR GetList
-
- FUNCTION Gets20
-
- LOCAL cVar1 := "cVar1", ;
- cVar2 := "cVar2", ;
- cVar3 := "cVar3", ;
- cVar4 := "cVar4"
-
- CLEAR SCREEN
- @ 10, 10 GET cVar1 ;
- VALID iif(LastKey() == K_DOWN, (GoToGet(3), .T.), .T.)
-
- @ 10, 40 GET cVar2 ;
- VALID iif(LastKey() == K_DOWN, (GoToGet(4), .T.), .T.)
-
- @ 11, 10 GET cVar3 ;
- VALID iif(LastKey() == K_UP, (GoToGet(1), .T.), .T.)
-
- @ 11, 40 GET cVar4 ;
- VALID iif(LastKey() == K_UP, (GoToGet(2), .T.), .T.)
-
- READ ALLOWING MOVE
-
- RETURN NIL
-
-
- proc GetMoveReader( oGet )
-
- LOCAL nCurrentGet
-
- nCurrentGet := Ascan(GetList, {|o| o == oGet })
- IF !(GetMovingTo() == NIL) .AND. nCurrentGet != GetMovingTo()
- IF nCurrentGet > GetMovingTo()
- oGet:exitState := GE_UP
- ELSE
- oGet:exitState := GE_DOWN
- ENDIF
- ELSE
- GetMovingTo(NIL)
- // read the GET if the WHEN condition is satisfied
- IF ( GetPreValidate(oGet) )
- // activate the GET for reading
- oGet:SetFocus()
-
- DO WHILE ( oGet:exitState == GE_NOEXIT )
- // check for initial typeout (no editable positions)
- IF ( oGet:typeOut )
- oGet:exitState := GE_ENTER
- ENDIF
-
- // apply keystrokes until exit
- DO WHILE ( oGet:exitState == GE_NOEXIT )
- GetApplyKey(oGet, InKey(0))
- ENDDO
-
- // disallow exit if the VALID condition is not satisfied
- IF ( !GetPostValidate(oGet) )
- oGet:exitState := GE_NOEXIT
- ENDIF
- ENDDO
-
- // de-activate the GET
- oGet:KillFocus()
- ENDIF
- ENDIF
-
- RETURN
-
-
- FUNCTION GoToGet(n)
-
- LOCAL oGetCurrent := GetActive()
- LOCAL nGetCurrent := Ascan(GetList, {|o| o == oGetCurrent})
-
- IF nGetCurrent > n
- oGetCurrent:exitState := GE_UP
- ELSE
- oGetCurrent:exitState := GE_DOWN
- ENDIF
- GetMovingTo(n)
-
- RETURN NIL
-
-
- FUNCTION GetMovingTo(n)
-
- STATIC nWhereToGo
- LOCAL nOldWhereGo := nWhereToGo
-
- IF Pcount() > 0
- nWhereToGo := n
- ENDIF
-
- RETURN nOldWhereGo