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

  1. /*
  2.    Listing 4.2 Showmsg()
  3.    Author: Greg Lief
  4.    Excerpted from "Clipper 5: A Developer's Guide"
  5.    Copyright (c) 1991 M&T Books
  6.                       501 Galveston Drive
  7.                       Redwood City, CA 94063-4728
  8.                       (415) 366-3600
  9. */
  10.  
  11. ** written to conform to Summer '87
  12.  
  13. function ShowMsg
  14. parameter msg, boxcolor, msgcolor
  15. private oldcolor, buffer, leftcol
  16. //───── assign box color
  17. if pcount() < 2                 // did not pass second parameter
  18.    boxcolor = 'W/R'
  19. elseif type('boxcolor') != 'C'  // passed a non-character string
  20.    boxcolor = 'W/R'
  21. elseif empty(boxcolor)          // passed a null string
  22.    boxcolor = 'W/R'
  23. endif
  24. //───── assign message color
  25. if pcount() < 3                 // did not pass third parameter
  26.    msgcolor = '+W/R'
  27. elseif type('msgcolor') != 'C'  // passed a non-character string
  28.    msgcolor = '+W/R'
  29. elseif empty(msgcolor)          // passed a null string
  30.    msgcolor = '+W/R'
  31. endif
  32. leftcol = int(76 - len(msg)) / 2
  33. buffer = savescreen(11, leftcol, 13, 80 - leftcol)
  34. oldcolor = setcolor(boxcolor)
  35. @ 11, leftcol, 13, 80 - leftcol BOX '╔═╗║╝═╚║ '
  36. setcolor(msgcolor)
  37. @ 12, leftcol + 2 say msg
  38. inkey(2)
  39. restscreen(11, leftcol, 13, 80 - leftcol, buffer)
  40. setcolor(oldcolor)
  41. return nil
  42.  
  43. * end of file CHP0402.PRG
  44.