home *** CD-ROM | disk | FTP | other *** search
- /*
- Listing 26.10 Inserting Data into a GET
- Author: Greg Lief
- Special Thanks to Tim Creagh for the inspiration!
- 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!
-
- function main
- local m_var := [Mr. , Director of Communications]
- set key -1 to showfields
- cls
- @ 1, 20 get m_var
- @ 2, 22 say "Press F2 to select from list of names"
- read
- ? m_var
- return nil
-
-
- static procedure showfields(a, b, c)
- local position := getactive():pos, val := getactive():varGet()
- local names := { "Bayne", "Creagh", "Lief", "Yellick", "Welter" }
- local ele := 0, xx, oldscrn := savescreen(9, 35, 15, 44)
- @ 9, 35 to 15, 44
- //───── don't allow Esc, which would cause array access error
- do while ele = 0
- ele = achoice(10, 36, 14, 43, names)
- enddo
- //───── drop selected name into GET at current position
- getactive():varPut(substr(val, 1, position - 1) + names[ele] + ;
- substr(val, position))
- //───── move cursor to original location in GET buffer, based on
- //───── length of the name we just inserted
- for xx = 1 to len( names[ele] )
- getactive():right()
- next
- restscreen(9, 35, 15, 44, oldscrn)
- return
-
- // end of file CHP2610.PRG
-