home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 5 / 05.iso / a / a012 / 1.ddi / CHAP26.EXE / CHP2610.PRG < prev    next >
Encoding:
Text File  |  1991-04-30  |  1.4 KB  |  46 lines

  1. /*
  2.    Listing 26.10 Inserting Data into a GET
  3.    Author: Greg Lief
  4.    Special Thanks to Tim Creagh for the inspiration!
  5.    Excerpted from "Clipper 5: A Developer's Guide"
  6.    Copyright (c) 1991 M&T Books
  7.                       501 Galveston Drive
  8.                       Redwood City, CA 94063-4728
  9.                       (415) 366-3600
  10. */
  11.  
  12. //───── NOTE: must compile with the /N option!
  13.  
  14. function main
  15. local m_var := [Mr. , Director of Communications]
  16. set key -1 to showfields
  17. cls
  18. @ 1, 20 get m_var
  19. @ 2, 22 say "Press F2 to select from list of names"
  20. read
  21. ? m_var
  22. return nil
  23.  
  24.  
  25. static procedure showfields(a, b, c)
  26. local position := getactive():pos, val := getactive():varGet()
  27. local names := { "Bayne", "Creagh", "Lief", "Yellick", "Welter" }
  28. local ele := 0, xx, oldscrn := savescreen(9, 35, 15, 44)
  29. @ 9, 35 to 15, 44
  30. //───── don't allow Esc, which would cause array access error
  31. do while ele = 0
  32.    ele = achoice(10, 36, 14, 43, names)
  33. enddo
  34. //───── drop selected name into GET at current position
  35. getactive():varPut(substr(val, 1, position - 1) + names[ele] + ;
  36.                    substr(val, position))
  37. //───── move cursor to original location in GET buffer, based on
  38. //───── length of the name we just inserted
  39. for xx = 1 to len( names[ele] )
  40.    getactive():right()
  41. next
  42. restscreen(9, 35, 15, 44, oldscrn)
  43. return
  44.  
  45. // end of file CHP2610.PRG
  46.