home *** CD-ROM | disk | FTP | other *** search
- /***
- * Getex03.prg
- *
- * Get reader using + / - keys to change dates
- */
-
- #include "Getexit.ch"
-
- #command @ <row>, <col> GET <var> ;
- [<clauses,...>] ;
- DATE ;
- [<moreClauses,...>] ;
- ;
- => @ <row>, <col> GET <var> ;
- [<clauses>] ;
- SEND reader := {|oGet| DateReader(oGet) } ;
- [<moreClauses>]
-
- #define K_PLUS 43
- #define K_MINUS 45
-
- MEMVAR GetList
-
- FUNCTION Gets09
-
- LOCAL dVar1 := Date()
-
- CLEAR SCREEN
- @ 10, 10 SAY "Enter dVar1" GET dVar1 DATE
- READ
-
- RETURN NIL
-
-
- proc DateReader( get )
-
- LOCAL nKey
-
- // read the GET if the WHEN condition is satisfied
- IF ( GetPreValidate(get) )
- // activate the GET for reading
- get:SetFocus()
-
- DO WHILE ( get:exitState == GE_NOEXIT )
- // check for initial typeout (no editable positions)
- IF ( get:typeOut )
- get:exitState := GE_ENTER
- ENDIF
-
- // apply keystrokes until exit
- DO WHILE ( get:exitState == GE_NOEXIT )
- nKey := InKey(0)
- IF nKey == K_PLUS
- get:buffer := Transform(get:unTransform() + 1, get:picture)
- get:changed := .T.
- get:display()
- ELSEIF nKey == K_MINUS
- get:buffer := Transform(get:unTransform() - 1, get:picture)
- get:changed := .T.
- get:display()
- ELSE
- GetApplyKey(get, nKey)
- ENDIF
- ENDDO
-
- // disallow exit if the VALID condition is not satisfied
- IF ( !GetPostValidate(get) )
- get:exitState := GE_NOEXIT
- ENDIF
- ENDDO
-
- // de-activate the GET
- get:KillFocus()
- ENDIF
-
- RETURN
-