home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 5 / 05.iso / a / a054 / 1.img / GETPRGS.EXE / GETS11.PRG < prev    next >
Encoding:
Text File  |  1992-03-09  |  2.0 KB  |  85 lines

  1. /***
  2. * Gets11.prg
  3. *
  4. * Get reader implementing during clause
  5. */
  6.  
  7. #include "Getexit.ch"
  8.  
  9.  
  10. #command @ <row>, <col> GET <var>                                   ;
  11.                         [<clauses,...>]                             ;
  12.                         DURING <b> EVERY <n>                        ;
  13.                         [<moreClauses,...>]                         ;
  14.                                                                     ;
  15.     => @ <row>, <col> GET <var>                                     ;
  16.                       [<clauses>]                                   ;
  17.                       SEND reader := {|oGet|                        ;
  18.                                       GetDuring(oGet, <{b}>, <n>) } ;
  19.                       [<moreClauses>]
  20.  
  21. MEMVAR GetList
  22.  
  23. FUNCTION Gets11
  24.  
  25. LOCAL cVar1 := Space(10), ;
  26.       cVar2 := Space(15), ;
  27.       cVar3 := Space(12)
  28.  
  29.   CLEAR SCREEN
  30.   @ 10, 10 SAY "Enter cVar1" GET cVar1
  31.   @ 11, 10 SAY "Enter cVar2" GET cVar2
  32.   @ 12, 10 SAY "Enter cVar3" GET cVar3 DURING t() EVERY 1
  33.  
  34.   READ
  35.  
  36. RETURN NIL
  37.  
  38.  
  39. proc GetDuring( oGet, bDuring, nTimeout )
  40.  
  41. LOCAL nKey
  42.  
  43.   // read the GET if the WHEN condition is satisfied
  44.   IF ( GetPreValidate(oGet) )
  45.     // activate the GET for reading
  46.     oGet:SetFocus()
  47.  
  48.     DO WHILE ( oGet:exitState == GE_NOEXIT )
  49.       // check for initial typeout (no editable positions)
  50.       IF ( oGet:typeOut )
  51.         oGet:exitState := GE_ENTER
  52.       ENDIF
  53.  
  54.       // apply keystrokes until exit
  55.       DO WHILE ( oGet:exitState == GE_NOEXIT )
  56.         IF (nKey := InKey(nTimeOut)) != 0
  57.           GetApplyKey(oGet, nKey)
  58.         ELSE
  59.       Eval(bDuring, oGet)
  60.         ENDIF
  61.       ENDDO
  62.  
  63.       // disallow exit if the VALID condition is not satisfied
  64.       IF ( !GetPostValidate(oGet) )
  65.         oGet:exitState := GE_NOEXIT
  66.       ENDIF
  67.     ENDDO
  68.  
  69.     // de-activate the GET
  70.     oGet:KillFocus()
  71.   ENDIF
  72.  
  73. RETURN
  74.  
  75.  
  76. FUNCTION T()
  77.  
  78. LOCAL nSr := Row(), ;
  79.       nSc := Col()
  80.  
  81.   @ 0, 0 SAY Time()
  82.   @ nsr, nsc SAY ""
  83.  
  84. RETURN NIL
  85.