DispBox

DispBox

Displays a box on the screen.

Syntax

      DispBox( <nTop>, <nLeft>, <nBottom>, <nRight>, ;
             [<cnBoxString>] , [<cColor>] ) --> NIL

Arguments

<nTop> and <nLeft> : screen coordinates for the upper left corner of the DispBox()output

<nBottom> and <nRight> : screen coordinates for the lower right corner of the DispBox()output

<cnBoxString> : The appearance of the box to display can either be specified as numeric 1 (single line box), numeric 2 (double line box), or as a character string holding up to nine characters. The first eight characters define the border of the box while the ninth character is used to fill the box. #define constants to be used for <cnBoxString> are available in the BOX.CH #include file.

Pre-defined box strings for DispBox()

         Constant        Description
         --------------- ----------------------------------------
         B_SINGLE        Single-line box
         B_DOUBLE        Double-line box
         B_SINGLE_DOUBLE Single-line top, double-line sides
         B_DOUBLE_SINGLE Double-line top, single-line sides

If no <cnBoxString> is specified, a single-line box is drawn. <cColor> : SetColor() compliant color string; default is the standard color of SetColor().

Return

DispBox() returns always NIL.

Description

The function DispBox() displays a box on the screen as specified with <cnBoxString>, using the standard color of SetColor() or <cColor>, if specified.

If a character string is used for <cnBoxString>, the first eight characters define the border of the box in clockwise direction, beginning with the upper left corner. An optional ninth character fills the area inside the box. Alternatively, a single character can be passed which is used to draw the entire box border. When the box is completely drawn, the cursor is positioned at the coordinates <nTop>+1 and <nLeft>+1, so that a subsequent DispOut() call starts displaying in the upper left corner of the box area.

Example

      // The example demonstrates how characters are used to draw a box.
      // Alphabetic characters define <cnBoxString> instead of characters
      // holding graphic signs.

      #include "Box.ch"

      PROCEDURE Main
         CLS
         DispBox( 10,10,20,50, "AbCdEfGhi", "W+/R" )

         Inkey(0)

         DispBox( 10,10,20,50, B_DOUBLE + Space(1) )
         DispOut( "Using #define constant" )

         @ MaxRow(),0
      RETURN

Seealso

@…BOX, @…CLEAR, @…TO, Scroll(), SetColor()

@…TO

@…TO

Draw a single- or double-line box

Syntax

       @ <nTop>, <nLeft>
              TO <nBottom>, <nRight> [DOUBLE] [COLOR <cColorString>]

Arguments

<nTop>, <nLeft>, <nBottom>, and <nRight> define the coordinates of the box. @…TO draws the box using row values from zero to MAXROW() and column values from zero to MAXCOL(). <nBottom> and <nRight> can be larger than the screen size, but output is clipped at MAXROW() and MAXCOL().

DOUBLE draws the box with a double line. If not specified, the box is drawn with a single line.

COLOR <cColorString> defines the display color of the drawn box. If not specified, the box is drawn using the standard color setting of the current system color as defined by SETCOLOR(). Note that <cColorString> is a character expression containing the standard color setting. If you specify a literal color setting, enclose it within quote marks.

Description

@…TO draws a single- or double-line box on the screen. If <nTop> and <nBottom> are the same, a horizontal line is drawn. If <nLeft> and <nRight> are the same, a vertical line is drawn.

After @…TO finishes drawing, the cursor is located in the upper-left corner of the boxed region at <nTop> + 1 and <nLeft> + 1. ROW() and COL() are also updated to reflect the new cursor position.

@…TO is like @…BOX except that @…BOX lets you define the characters of the box and supports a fill character. @…TO, however, is recommended for portability since it does not require the specification of hardware-dependent graphics characters.

Examples

       .  This example erases a region of the screen, then draws a box
       of the same size:

       @ 10, 10 CLEAR TO 20, 40
       @ 10, 10 TO 20, 40 DOUBLE COLOR "BG+/B"

Seealso

@…BOX, @…CLEAR, DISPBOX()

@…CLEAR

@…CLEAR

Clear a rectangular region of the screen

Syntax

       @ <nTop>, <nLeft> [CLEAR
              [TO <nBottom>, <nRight>]]
              [DOUBLE] [COLOR <cColor>]

Arguments

<nTop> and <nLeft> define the upper-left corner coordinate.

TO <nBottom>, <nRight> defines the lower-right corner coordinates of the screen region to CLEAR. If the TO clause is not specified, these coordinates default to MAXROW() and MAXCOL().

Description

@…CLEAR erases a rectangular region of the screen by filling the specified region with space characters using the current standard color setting. After @…CLEAR erases the designated region, the cursor is located in the upper corner of the region at <nTop> + 1 and <nLeft> + 1. ROW() and COL() are also updated to reflect the new cursor position.

Examples

       .  This example erases the screen from 10, 10 to 20, 40, painting
       the region blue and then displaying a bright cyan box on blue:

       SETCOLOR("BG+/B")
       @ 10, 10 CLEAR TO 20, 40
       @ 10, 10 TO 20, 40

Sealso

@…BOX, CLEAR SCREEN, SCROLL(), SETCOLOR()

SP_XBXX

XBXX()

  Short:
  ------
  XBXX() Draws an exploding box on the screen of a given color

  Returns:
  --------
  Nothing

  Syntax:
  -------
  XBxx(nTop,nLeft,nBottom,nRight,[nColor],[nShadow];
                      [nShadowColor],[cFrame])

  Description:
  ------------
  <nTop >      - top row
  <nLeft>      - left col
  <nBottom>    - bottom row
  <nRight>     - right column
  [nColor]     - attribute to box default setcolor()
  [nShadow]    - numeric shadow type  (default 0)
                    follow numeric keypad
                        7 = upper left
                        1 = lower left
                        3 = lower right
                        9 = upper right
                        0 = no shadow

  [nShadowColor]   - shadow attribute (default 7 - grey on black)

  [cFrame ]    - frame string - MUST be 9 characters - default single line

  Examples:
  ---------
   XBXX(10,10,20,20,47,9,8)

  Notes:
  -------
  Previously a 'C' function, now Clipper 5.01.

  Source:
  -------
  S_XBXX.PRG

 

SP_UNBOX

UNBOX()

  Short:
  ------
  UNBOX() Removes a box created by makebox()

  Returns:
  --------
  Nothing

  Syntax:
  -------
  Unbox([cMakeBox],[nTop,nLeft,nBottom,nRight],[expRestScreen] )

  Description:
  ------------
  UNBOX restores the screen <cMakeBox> saved by
  MAKEBOX(). MAKEBOX() stores the dimensions and color in the
  returned string, so it is not necessary to pass these to
  UNBOX(). If the dimensions are passed, UNBOX() assumes these are
  not part of the saved string, and assumes the string is a
  savescreen() string. If the string and any other single param
  are passed, UNBOX() assumes it is a full screen (0,0,24,79)
  restore and does so.

  [nTop,nLeft,nBottom,nRight] - the dimensions of the box.

  Use these to UNBOX() a screen saved with SAVESCREEN().

  [bcRestScreen] This is a block which can override the
  default screen restore mechanism. If passed, this screen restore
  is used instead of the default. To set back to default, pass
  this parameter as an empty string "". If passing this parameter,
  pass all other parameters as NIL. What this does, basically, is
  set up a static variable which holds the screen restore block.
  Default is {|t,l,b,r,s|restscreen(t,l,b,r,s)} or if sls_xplode()
  is (.t.), {|t,l,b,r,s|bxx_imbox(t,l,b,r,s)} (an internal
  function within S_UNBOX.PRG) .

  Examples:
  ---------
   cMsgBox := MAKEBOX(10,40,12,60,'W/R,+GR/R')

   @11,42 SAY "What's up, Doc ?"

   inkey(0)

   UNBOX(cMsgBox)

   // to set up the alternate screen restore method:
  unbox(nil,nil,nil,nil,nil,{|t,l,b,r,s| ss_fade(t,l,b,r,s)})
  unbox(nil,nil,nil,nil,nil,{|t,l,b,r,s| ss_fall(t,l,b,r,s,100)} )

   // to set screen restore back to the default
  unbox(nil,nil,nil,nil,nil,"")

  Source:
  -------
  S_UNBOX.PRG

 

SP_SL_BOX

SL_BOX()

  Short:
  ------
  SL_BOX() Draws a box line from row,col to endrow,endcol

  Returns:
  --------
  cCode => control string to send to the printer

  Syntax:
  -------
  SL_BOX(nTop,nLeft,nBottom,nRight,[cShade],[nDPIThick],[nCpi],[nLpi])

  Description:
  ------------
  Draws a box from nTop,nLeft to nBottom,nRight. Based
  on rows and columns.

  [cShade] refers to the density of the line.

  The shading percentages are (default "100" - black) :

         "1 thru 2" = 2% shade
        "3 thru 10" = 10% shade
       "11 thru 20" = 20% shade
       "21 thru 35" = 30% shade
       "36 thru 55" = 45% shade
       "56 thru 80" = 70% shade
       "81 thru 99" = 90% shade
              "100" = 100% shade

  [nDPIThick] is the thickness in DotsPerInch of the
  line. Default is 2.

  [nCpi] is the characters per inch, and defaults to 10.

  [nLpi] is the lines per inch, and defaults to 6.

  Examples:
  ---------
   SL_BOX(10,10,20,20,"50",10)
                     // draws a box 10,10 to 20 20 with 50%
                        //shading and 10 DPI thick

  Notes:
  -------
  Does not send anything to the printer - instead
  returns a control string that you send to the printer. String can be
  sent with ? or ?? or  QOUT() or QQOUT().

  QOUT() or QQOUT().

  For HP and compatible(PCL) Laserjet printers.

  Source:
  -------
  S_HPLAS.PRG

 

SP_SBUNSHADOW

SBUNSHADOW()

  Short:
  ------
  SBUNSHADOW() Removes shadow drawn with SBSHADOW()

  Returns:
  --------
  Nil

  Syntax:
  -------
  SBUNSHADOW(aSaved)

  Description:
  ------------
  Removes a shadow around a box created with
  SBSHADOW(). SBSHADOW() returns an array containing the
  coordinates and saved screens for each side of the shadow.
  SBUNSHADOW uses this array to restore the previous screens.

  Examples:
  ---------
   Dispbox(10,10,20,20)
   aSaved := sbshadow(10,10,20,20,3,8)
             // draws a shadow in the lower right
                              // of color gray on black
   sbunshadow(aSaved)         // restore old screen

  Source:
  -------
  S_BOXES.PRG

 

SP_SBSHADOW

SBSHADOW()

  Short:
  ------
  SBSHADOW() Draw a shadow around a box

  Returns:
  --------
  <aSaved> => an array containing the two saved screen
  sections

  Syntax:
  -------
  SBSHADOW(nTop,nLeft,nBottom,nRight,nShadowPos,nShadowAtt)

  Description:
  ------------
  Draws a shadow for box described in coordinates
  <nTop,nLeft,nBotton,nRight>

  The shadow is of color <nShadowAtt> and is at
  position <nShadowPos>, which is one of the following:

      LOWER LEFT    1
      LOWER RIGHT   3
      UPPER LEFT    7
      UPPER RIGHT   9

  Returns an array with the saved screens for each side
  of the shadow.

  This array can be passed to SBUNSHADOW() for
  restoring the previous screen.

  Examples:
  ---------
   Dispbox(10,10,20,20)
   aSaved := sbshadow(10,10,20,20,3,8)
              // draws a shadow in the lower right
              // of color gray on black
   sbunshadow(aSaved)         // restore old screen

  otes

  Source:
  -------
  S_BOXES.PRG

 

SP_SBROWS

SBROWS()

  Short:
  ------
  SBROWS() Determine number of rows in a box

  Returns:
  --------
  <nRows> => rows in the box

  Syntax:
  -------
  SBROWS(nTop,nBottom,[lIncludeFrame])

  Description:
  ------------
  The number of rows of a box with top of <nTop> and
  bottom of <nBottom> is returned. By default, the frame is
  included (the top and the bottom)

  [lIncludeFrame] by default is True - and all rows are
  counted. If passed as False, only the inside rows are counted.

  Examples:
  ---------
   nRows := SBROWS(nTop,nBottom,.f.)
   for i = nTop to nRows
     @nTop+i,nLeft say i
   next

  Source:
  -------
  S_BOXES.PRG