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

  1. /*
  2.    Program: POPNDROP() (covers both POPBOX() and DROPBOX())
  3.    System: GRUMPFISH LIBRARY
  4.    Author: Greg Lief
  5.    Copyright (c) 1988-90, Greg Lief
  6.    Clipper 5.x version
  7.    Compile instructions: clipper popbox /n/w/a
  8.  
  9.    Draws pop-up or drop-down box.  In the Summer '87 version,
  10.    this was split into two functions.  However, it was simple
  11.    enough to combine them into one through the use of the
  12.    preprocessor.  The first parameter passed by the preprocessor
  13.    is the direction: 1 = UP (popbox)  2 = DOWN (dropbox)
  14.  
  15.    Calls: BOX_TITLE()      (Function in $BOXTIT.PRG)
  16. */
  17.  
  18. //───── begin preprocessor directives
  19.  
  20. #include "grump.ch"
  21.  
  22. //───── end preprocessor directives
  23.  
  24. function PopNDrop(ndirection, ntop, nleft, nbottom, nright, ntype, ndelay, ;
  25.                   lshadow, ctitle, lcrossbar)
  26. local x, y, ret_val, z[3], boxstring, oldcurs := setcursor(0)
  27. //───── establish defaults if parameters were not passed
  28. default ntype to 1
  29. default ndelay to 15
  30. default lshadow to .f.
  31. default ctitle to []
  32. lcrossbar := (pcount() > 9)
  33. //───── limit border # to 6 to avoid array crash
  34. boxstring := BOXFRAMES[if(ntype > 6, 1, ntype)]
  35.  
  36. //───── establish variables and loop counter for the FOR..NEXT loop based
  37. //───── upon the direction passed to this parameter (1 = up, 2 = down)
  38. if nDirection = 1
  39.    z := {nbottom, ntop, -1}
  40. else
  41.    z := {ntop, nbottom, 1}
  42. endif
  43.  
  44. //───── construct array containing coordinates & contents of screen
  45. //───── area underneath this box - this can be used with byebyebox()
  46. ret_val := { ntop, nleft, nbottom + if(lshadow, 1, 0), ;
  47.              nright + if(lshadow, 2, 0), savescreen(ntop, nleft, ;
  48.              nbottom + if(lshadow, 1, 0), nright + if(lshadow, 2, 0)) }
  49.  
  50. //───── loop the loop
  51. for x = z[1] to z[2] step z[3]
  52.    if z[3] > 0
  53.       @ z[1], nleft, x, nright box boxstring
  54.    else
  55.       @ x, nleft, nbottom, nright box boxstring
  56.    endif
  57.    for y = 1 to ndelay
  58.    next
  59. next
  60.  
  61. * draw lshadow if requested
  62. if lshadow .and. nbottom < maxrow() .and. nright < maxcol() - 1
  63.    gfattr(ntop + 1, nright + 1, nbottom + 1, nright + 2, 8)
  64.    gfattr(min(nbottom + 1, maxcol()-1), nleft + 2, nbottom + 1, nright + 2, 8)
  65. endif
  66.  
  67. * draw title if requested
  68. if len(ctitle) > 0
  69.    box_title(ntop, nleft, nright, ctitle, boxstring, lcrossbar)
  70. endif
  71. setcursor(oldcurs)
  72. return (ret_val)
  73.  
  74. * end function PopBox()
  75. *--------------------------------------------------------------------*
  76.  
  77. * eof popbox.prg
  78.