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

  1. /***
  2. * Getex03.prg
  3. *
  4. * Get reader using + / - keys to change dates
  5. */
  6.  
  7. #include "Getexit.ch"
  8.  
  9. #command @ <row>, <col> GET <var>                                       ;
  10.                         [<clauses,...>]                                 ;
  11.                         DATE                                            ;
  12.                         [<moreClauses,...>]                             ;
  13.                                                                         ;
  14.       => @ <row>, <col> GET <var>                                       ;
  15.                         [<clauses>]                                     ;
  16.                         SEND reader := {|oGet| DateReader(oGet) }       ;
  17.                         [<moreClauses>]
  18.  
  19. #define K_PLUS   43
  20. #define K_MINUS  45
  21.  
  22. MEMVAR GetList
  23.  
  24. FUNCTION Gets09
  25.  
  26. LOCAL dVar1 := Date()
  27.  
  28.   CLEAR SCREEN
  29.   @ 10, 10 SAY "Enter dVar1" GET dVar1 DATE
  30.   READ
  31.  
  32. RETURN NIL
  33.  
  34.  
  35. proc DateReader( get )
  36.  
  37. LOCAL nKey
  38.  
  39.   // read the GET if the WHEN condition is satisfied
  40.   IF ( GetPreValidate(get) )
  41.     // activate the GET for reading
  42.     get:SetFocus()
  43.  
  44.     DO WHILE ( get:exitState == GE_NOEXIT )
  45.       // check for initial typeout (no editable positions)
  46.       IF ( get:typeOut )
  47.         get:exitState := GE_ENTER
  48.       ENDIF
  49.  
  50.       // apply keystrokes until exit
  51.       DO WHILE ( get:exitState == GE_NOEXIT )
  52.         nKey := InKey(0)
  53.         IF nKey == K_PLUS
  54.           get:buffer := Transform(get:unTransform() + 1, get:picture)
  55.           get:changed := .T.
  56.           get:display()
  57.         ELSEIF nKey == K_MINUS
  58.           get:buffer := Transform(get:unTransform() - 1, get:picture)
  59.           get:changed := .T.
  60.           get:display()
  61.         ELSE
  62.           GetApplyKey(get, nKey)
  63.         ENDIF
  64.       ENDDO
  65.  
  66.       // disallow exit if the VALID condition is not satisfied
  67.       IF ( !GetPostValidate(get) )
  68.         get:exitState := GE_NOEXIT
  69.       ENDIF
  70.     ENDDO
  71.  
  72.     // de-activate the GET
  73.     get:KillFocus()
  74.   ENDIF
  75.  
  76. RETURN
  77.  
  78.