home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 5 / 05.iso / a / a054 / 1.img / GETLIB.EXE / TIMDREAD.PRG < prev   
Encoding:
Text File  |  1992-03-09  |  926 b   |  42 lines

  1. // Timdread.prg
  2. //
  3. // Get reader with timeout
  4.  
  5. #include "Getexit.ch"
  6.  
  7. proc TimedReader( get, nTimeOut )
  8.  
  9. LOCAL nKey
  10.  
  11.   // read the GET if the WHEN condition is satisfied
  12.   IF ( GetPreValidate(get) )
  13.     // activate the GET for reading
  14.     get:SetFocus()
  15.  
  16.     DO WHILE ( get:exitState == GE_NOEXIT )
  17.       // check for initial typeout (no editable positions)
  18.       IF ( get:typeOut )
  19.         get:exitState := GE_ENTER
  20.       ENDIF
  21.  
  22.       // apply keystrokes until exit
  23.       DO WHILE ( get:exitState == GE_NOEXIT )
  24.         IF (nKey := InKey(nTimeOut)) != 0
  25.           GetApplyKey(get, nKey)
  26.         ELSE
  27.           get:exitState := GE_ESCAPE
  28.         ENDIF
  29.       ENDDO
  30.  
  31.       // disallow exit if the VALID condition is not satisfied
  32.       IF ( !GetPostValidate(get) )
  33.         get:exitState := GE_NOEXIT
  34.       ENDIF
  35.     ENDDO
  36.  
  37.     // de-activate the GET
  38.     get:KillFocus()
  39.   ENDIF
  40.  
  41. RETURN
  42.