home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 5 / 05.iso / a / a067 / 1.img / GRUMP501.EXE / ERRMSG.PRG < prev    next >
Encoding:
Text File  |  1991-04-23  |  1.5 KB  |  59 lines

  1. /*
  2.     Program: ERR_MSG()
  3.     System: GRUMPFISH LIBRARY
  4.     Author: Greg Lief
  5.     Copyright (c) 1988-90, Greg Lief
  6.     Clipper 5.x Version
  7.     Compile instructions: clipper errmsg /n/w/a
  8.  
  9.     Displays error message and waits for user keypress
  10. */
  11.  
  12. //───── begin preprocessor directives
  13.  
  14. #include "grump.ch"
  15.  
  16. //───── end preprocessor directives
  17.  
  18. function err_msg(msgs, boxcolor, textcolor, sound)
  19. local oldscrn, x := 0, mlen, leftcol
  20. GFSaveEnv(, 0)                   // shut off cursor
  21.  
  22. //───── establish box and text colors if not passed as parameters
  23. default boxcolor to ColorSet(C_ERRORBOX, .t.)
  24. default textcolor to ColorSet(C_ERRORMESSAGE, .t.)
  25. default sound to .t.
  26.  
  27. //───── if message passed was a character string, convert to array
  28. if valtype(msgs) == "C"
  29.    msgs := { msgs }
  30. endif
  31.  
  32. //───── add keypress msg to array
  33. aadd(msgs, "** press any key to continue **")
  34. mlen := len(msgs)
  35.  
  36. //───── determine width of longest message in array
  37. aeval(msgs, { | a | x := max(len(a), x) } )
  38.  
  39. leftcol := int(maxcol() - 5 - max(x, 35)) / 2
  40. setcolor(boxcolor)
  41. oldscrn := shadowbox(10, leftcol, 11 + mlen, maxcol() - leftcol, 3, 'Error')
  42. setcolor(textcolor)
  43. for x = 1 to mlen
  44.    SCRNCENTER(10 + x, msgs[x])
  45. next
  46. if sound
  47.    tone(MUSIC_ERROR, 1)
  48.    tone(MUSIC_ERROR, 1)
  49. endif
  50. ginkey(0)
  51. GFRestEnv()
  52. byebyebox(oldscrn)
  53. return nil
  54.  
  55. * end function Err_Msg()
  56. *--------------------------------------------------------------------*
  57.  
  58. * eof errmsg.prg
  59.