home *** CD-ROM | disk | FTP | other *** search
- // GetDurng.prg
- //
- // Get Reader implementing during clause allowing exit
-
- #include "GetExit.ch"
-
- proc GetDuring( oGet, bDuring, nTimeout )
-
- LOCAL nKey
-
- // 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 )
- IF (nKey := InKey(nTimeOut)) != 0
- GetApplyKey(oGet, nKey)
- ELSE
- IF Eval(bDuring, oGet)
- oGet:exitState := GE_ESCAPE
- ENDIF
- ENDIF
- 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
-
- RETURN
-