home *** CD-ROM | disk | FTP | other *** search
- /*
- Listing 26.15 @..MESSAGE with cargo/reader instance variables
- Author: Greg Lief
- Excerpted from "Clipper 5: A Developer's Guide"
- Copyright (c) 1991 M&T Books
- 501 Galveston Drive
- Redwood City, CA 94063-4728
- (415) 366-3600
- */
-
- //───── NOTE: must compile with the /N option!
-
- #command @ <row>, <col> GET <var> [PICTURE <pic>] ;
- [VALID <valid>] [WHEN <when>] ;
- [MESSAGE <message>] => ;
- SetPos(<row>, <col>) ; ;
- AAdd( GetList, _GET_(<var>, <(var)>, <pic>, ;
- <{valid}>, <{when}>) ) ; ;
- Atail(getlist):reader := { | g | MyReader(g) } ;
- [; Atail(getlist):cargo := <message> ]
-
- #include "getexit.ch"
-
- function test
- local x := 0, y := 1, getlist := {}
- set message to maxrow()
- cls
- @ 20,0 get x message "This is the first GET"
- @ 21,0 get y
- read
- return nil
-
- /*
- MyReader()
- Alternate modal read of a single GET.
- */
- function MyReader( get )
- local mess_row
- // read the GET if the WHEN condition is satisfied
- if ( GetPreValidate(get) )
- // activate the GET for reading
- mess_row := set(_SET_MESSAGE)
- if ! empty(get:cargo)
- @ mess_row, 0 say padc( get:cargo, maxcol() + 1)
- else
- scroll(mess_row, 0, mess_row, maxcol(), 0)
- endif
- 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 )
- GetApplyKey( get, Inkey(0) )
- enddo
-
- // disallow exit if VALID condition is not satisfied
- if ( !GetPostValidate(get) )
- get:exitState := GE_NOEXIT
- endif
- enddo
-
- // de-activate the GET
- get:KillFocus()
-
- endif
- return nil
-
- // end of file CHP2615.PRG
-