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

  1. /*
  2.    Listing 12.14. A generic "prompt for a string" function.
  3.    (see also GETSTRING.CH)
  4.    Author: Craig Yellick
  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. #command default <var> to <value> => ;
  13.          if <var> = nil ; <var> := <value> ; endif
  14.  
  15. function GetString(r, c, message, msgColor, defAnswer, pict)
  16. /*
  17.    General-purpose "which customer #" prompt:
  18.      r          row,
  19.      c          column,
  20.      message    prompt to display at r, c,
  21.      msgColor   color to use for message,
  22.      defAnswer  default answer to prompt,
  23.      pict       picture to use with GET.
  24.  
  25.    Returns end-user's answer to the prompt.
  26. */
  27. local answer := defAnswer
  28. local getlist := {}
  29.  
  30.   default r         to row()
  31.   default c         to col()
  32.   default message   to "Your response?"
  33.   default msgColor  to "GR+/B"
  34.   default answer    to space(20)
  35.  
  36.   SaveEnv(msgColor, 1)
  37.   @ r, c say message get answer picture (pict)
  38.   read
  39.   RestEnv()
  40.  
  41. return answer
  42.  
  43. // end of file CHP1214.PRG
  44.