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

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