HB_Alert

HB_Alert

Displays a text-mode dialog box with a message.

Syntax

      HB_Alert( <xMessage>, [<aOptions>], [<cColor>], [<nDelay>] ) --> nChoice

Arguments

<xMessage> : The message to display. May be any data type. Character string may be divided display lines by the semicolon

<aOptions> : An array with available response as character strings. Default is { “Ok” }.

<cColor> : A string as color codes. Default color is “W+/R”.

<nDelay> : Number of seconds to wait to user response before abort. Default value is 0, that wait forever.

Returns

A numeric value indicating the ordinal position within <aOption> selected by the user. Zero value means that user pressed escape key.

If <nDelay> is specified and this number of seconds has elapsed without a key press, the return value is 1.

Description

HB_Alert() displays a dialog box and lets the user select an option. The user can move a highlight bar using arrow keys or the TAB key. To select an option, the user can press ENTER, SPACE or the first letter of an option.

HB_Alert() is extended version of Alert() to support all variables types (not just strings) is passed as first parameter.

Example

      // This example displays a message with two line : file name and 'not found' message.
      // After 15 seconds without user response, assumed 'Abort' selected.

      FUNCTION FNFMessage( cFileName )

         LOCAL cMessage, aOptions, nChoice

         aMessage := { cFileName, 'Not found !' }
         aOptions :=  { 'Abort', 'Retry', 'Skip' }

         nChoice := HB_Alert( aMessage, aOptions, , 15 )

      RETURN nChoice // FNFMessage()

Seealso

@…PROMPT, AChoice(), Alert(), DispBox(), DispOut(), MENU TO

@…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()

@…BOX

@…BOX

Draw a box on the screen

Syntax

       @ <nTop>, <nLeft>, <nBottom>, <nRight>
              BOX <cBoxString> [COLOR <cColorString>]

Arguments

<nTop>, <nLeft>, <nBottom>, <nRight> define the coordinates of the box. @…BOX draws a box using row values from zero to MAXROW(), and column values from zero to MAXCOL(). If <nBottom> and <nRight> are larger than MAXROW() and MAXCOL(), the bottom-right corner is drawn off the screen.

BOX <cBoxString> defines a string of eight border characters and a fill character. If <cBoxString> is specified as a single character, that character draws the whole box.

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 want to specify a literal color setting, enclose it within quote marks.

Description

@…BOX draws a box on the screen using configurable border and fill characters. @…BOX draws the box using <cBoxString> starting from the upper left-hand corner, proceeding clockwise and filling the screen region with the ninth character. If the ninth character is not specified, the screen region within the box is not painted. Existing text and color remain unchanged.

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

Examples

       .  These examples draw two boxes using box manifest constants
       defined in the supplied header file, Box.ch.  The first example draws
       a box using the specified characters for the border, but leaves all
       other areas of the screen intact.  The second example draws the same
       box filling the box region with space characters.

       #include "Box.ch"
       // Draw a box with a double-line top with a
       // single-line side
       @ 1, 1, 22, 79 BOX B_DOUBLE_SINGLE
       // Draw the same box filling the box region with
       // spaces
       @ 1, 1, 22, 79 BOX B_DOUBLE_SINGLE + SPACE(1)

Files

Header file is Box.ch.

Seealso

@…CLEAR, @…TO, DISPBOX(), SCROLL()

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_CLS

CLS()

  Short:
  ------
  CLS() Clear the screen with optional color,character

  Returns:
  --------
  Nothing

  Syntax:
  -------
  CLS([nAttribute],[cChar])

  Description:
  ------------
  Clear the screen.

  Optional color [nAttribute] and character [cChar].

  Examples:
  ---------
   CLS()   // clears screen with current color

   CLS(48) // clears screen with black on cyan

   CLS(8,chr(177))  // clears screen grey on black
                    // with character 177

  Notes:
  -------
  Of course in Clipper 5.01 you can also do:
  dispbox(0,0,24,79,repl(chr(177),9),"+N/N") and get the same
  result.

  Source:
  -------
  S_CLS.PRG

 

C5_DISPBOX

 DISPBOX()
 Display a box on the screen
------------------------------------------------------------------------------
 Syntax

     DISPBOX(<nTop>, <nLeft>, <nBottom>, <nRight>,
        [<cnBoxString>], [<cColorString>]) --> NIL

 Arguments

     <nTop>, <nLeft>, <nBottom>, and <nRight> define the
     coordinates of the box.  DISPBOX() draws a box using row values from
     zero to MAXROW(), and column values from zero to MAXCOL().  If <nBottom>
     and <nRight> are larger than MAXROW() and MAXCOL(), the bottom-right
     corner is drawn off the screen.

     <cnBoxString> is a numeric or character expression that defines the
     border characters of the box.  If specified as a numeric expression, a
     value of 1 displays a single-line box and a value of 2 displays a
     double-line box.  All other numeric values display a single-line box.

     If <cnBoxString> is a character expression, it specifies the characters
     to be used in drawing the box.  This is a string of eight border
     characters and a fill character.  If <cnBoxString> is specified as a
     single character, that character is used to draw the whole box.

     If this argument is not specified, a single-line box is drawn.

     <cColorString> defines the display color of the box that is drawn.
     If not specified, the box is drawn using the standard color setting of
     the current system color as defined by SETCOLOR().

 Returns

     DISPBOX() always returns NIL.

 Description

     DISPBOX() is a screen function that draws a box at the specified display
     coordinates in the specified color.  If you specify <cnBoxString>,
     DISPBOX() draws a box on the screen using configurable border and fill
     characters.  DISPBOX() draws the box using <cnBoxString> starting from
     the upper left-hand corner, proceeding clockwise and filling the screen
     region with the ninth character.  If the ninth character is not
     specified, the screen region within the box is not painted.  Existing
     text and color remain unchanged.

     In cases where cnBoxString respects Clipper conventions, the behavior
     of DISPBOX() is unchanged.  The behavior of this function can easily be
     modified to take advantage of graphic mode.  For example, you can
     replace the standard window frames using single or double lines with new
     graphical frames that have an impressive 3-D look.  Simply replace the
     cBoxString parameter using the following:

     CHR(2) + CHR(nColor+1) // draws a box of thickness 16x8x16x8
     CHR(3) + CHR(nColor+1) // draws a box of thickness 8x8x8x8
     CHR(4) + CHR(nColor+1) // draws a box of thickness

                            // 16x16x16x16
     CHR(5) + CHR(nColor+1) // draws a box of thickness 16x8x8x8

     Note that <nColor> is a numeric color representation.  You must add 1 to
     this value.

     In general, CHR(2) + CHR(nColor+1) can be used instead of Clipper's
     B_SINGLE or B_DOUBLE defines.

     Clipper graphics comes with two #defines LLG_BOX_GRAY_STD and
     LLG_BOX_GRAY_SQUARE to allow gray (nColor=7) boxes of width 16x8 or
     16x16.

     You can completely customize the box by passing chr(1) + ... as the
     first parameter:

     CHR(1)             + ;  // Box entirely defined
     CHR(nBackColor+1)  + ;  // Color used as background fill
     CHR(nLightColor+1) + ;  // Color used to lighten the frame
     CHR(nDarkColor+1)  + ;  // Color used to darken the frame
     CHR(nWidthUp)      + ;  // Thickness of upper edge of box
     CHR(nWidthRight)   + ;  // Thickness of right edge of box
     CHR(nWidthDown)    + ;  // Thickness of lower edge of box
     CHR(nWidthLeft)         // Thickness of left edge of box

     After DISPBOX() executes, the cursor is located in the upper corner of
     the boxed region at <nTop> + 1 and <nLeft> + 1.  ROW() and COL() are
     also updated to reflect the new cursor position.

     Note that Box.ch, located in \CLIP53\INCLUDE, provides constants for
     various border configurations.

 Notes

     The number of colors available depends on the current video mode setting
     ( SET VIDEOMODE ).

 Examples

     .  This code example displays a double-line box using a numeric
        value to specify the box border:

        #define B_SINGLE   1
        #define B_DOUBLE   2
        //
        DISPBOX(1, 1, 10, 10, B_DOUBLE, "BG+/B")

     .  This example displays a single-line top and double-line side
        box by specifying border characters with a manifest constant defined
        in Box.ch:

        #include "Box.ch"
        //
        DISPBOX(1, 1, 10, 10, B_SINGLE_DOUBLE, "BG+/B")

     .  This example displays a box with a 3-D look.  It can be used
        for graphic mode:

        // Display a box with a 3D look of constant width 16x16x16x16
        DISPBOX( nTop, nLeft, nBottom, nRight, LLG_BOX_GRAY_SQUARE )
        // Write some transparent text in the 3D frame
        GWRITEAT(  nLeft * GMODE()[LLG_MODE_FONT_COL] ,;
        nTop  * GMODE()[LLG_MODE_FONT_ROW] ,;
        "This is some Text...",;
        4,;
        LLG_MODE_SET; )

 Files   Library is LLIBG.LIB, header file is Llibg.ch.

See Also: GFRAME() GMODE() SET VIDEOMODE