home *** CD-ROM | disk | FTP | other *** search
- // Timdread.prg
- //
- // Get reader with timeout
-
- #include "Getexit.ch"
-
- 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