home *** CD-ROM | disk | FTP | other *** search
- /***
- * Gets10.prg
- *
- * Get reader with timeout
- */
-
- #include "Getexit.ch"
-
- #command READ TIMEOUT AT <n> ;
- => ;
- Aeval(GetList, ;
- {|o| o:reader := ;
- {|oGet| TimedReader(oGet, <n>) } }) ;;
- READ
-
- MEMVAR GetList
-
- FUNCTION Gets10
-
- LOCAL cVar1 := Space(10), ;
- cVar2 := Space(15), ;
- cVar3 := Space(12)
-
- CLEAR SCREEN
- @ 10, 10 SAY "Enter cVar1" GET cVar1
- @ 11, 10 SAY "Enter cVar2" GET cVar2
- @ 12, 10 SAY "Enter cVar3" GET cVar3
-
- READ TIMEOUT AT 4
-
- RETURN NIL
-
-
- proc TimedReader( get, nTimeOut )
-
- LOCAL nKey
-
- // read the GET if the WHEN condition is satisfied
- IF ( GetPreValidate(get) )
- // activate the GET for reading
- get:SetFocus()
-
- DO WHILE ( get:exitState == GE_NOEXIT )
- // check for initial typeout (no editable positions)
- IF ( get:typeOut )
- get:exitState := GE_ENTER
- ENDIF
-
- // apply keystrokes until exit
- DO WHILE ( get:exitState == GE_NOEXIT )
- IF (nKey := InKey(nTimeOut)) != 0
- GetApplyKey(get, nKey)
- ELSE
- get:exitState := GE_ESCAPE
- ENDIF
- ENDDO
-
- // disallow exit if the VALID condition is not satisfied
- IF ( !GetPostValidate(get) )
- get:exitState := GE_NOEXIT
- ENDIF
- ENDDO
-
- // de-activate the GET
- get:KillFocus()
- ENDIF
-
- RETURN
-
-