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

 

SP_SBCOLS

SBCOLS()

  Short:
  ------
  SBCOLS() Determine number of columns in a box

  Returns:
  --------
  <nCols> => columns in the box

  Syntax:
  -------
  SBCOLS(nLeft,nRight,[lIncludeFrame])

  Description:
  ------------
  The number of columns of a box with left of <nLeft>
  and right of <nRight> is returned. By default, the frame is
  included (the left and the right)

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

  Examples:
  ---------
   // this example fills a box with "X"'s

   nRows := SBROWS(nTop,nBottom,.f.)
   nCols := SBCOLS(nLeft,nRight,.f.)
   for i = nTop to nRows
     @nTop+i,nLeft say repl("X",nCols)
   next

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

 

SP_SBCENTER

SBCENTER()

  Short:
  ------
  SBCENTER() Centers box coordinates

  Returns:
  --------
  Nil

  Syntax:
  -------
  SBCENTER(@nTop,@nLeft,@nBottom,@nRight)

  Description:
  ------------
  Dimensions nTop,nLeft,nBottom,nRight are passed by
  reference.

  They are changed by SBCENTER to dimensions that are
  centered on the screen.

  Examples:
  ---------

   nTop    := 0
   nLeft   := 0
   nBottom := nRows+2
   nRight  := nMaxwidth+2

   SBCENTER(@nTop,@nLeft,@nBottom,@nRight)
                  // center the coordinates

   cBox := makebox(nTop,nLeft,nBottom,nRight)

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

 

SP_PULLDN

PULLDN()

  Short:
  ------
  PULLDN() Pulldown menu creator, handler

  Returns:
  --------
  <nSelection> => Selection in the form menu.prompt
  (i.e. 2.04)

  Syntax:
  -------
  PULLDN(nSelection,aOptions,[aAttributes],[aColumns])

  Description:
  ------------
  Draws a pulldown menu with up to 8 separate boxes.
  Selection process starts with <nSelection>.

  Each element of <aOptions> defines a menu.

  A menu definition is a delimited string in the form:

        "TITLE:prompt:prompt:prompt"

  with up to 99 prompts per string.

  When a selection is made, the number of the selection
  is returned, in the form BOX.OPTION . So option 2 in box 3 would
  come back as 3.02.

  [aAttributes] is a box definition array. It is 7
  elements long and defines the following:

  Element:          1. <lDraw>      Draw top bar box? T/F
                    2. <cBarColor>  Top bar color
                    3. <cBoxColor>  Menu Box color
                    4. <cBoxFrame>  Menu Box frame
                    5. <nShadowPos> Menu Box shadow position
                               (0,1,3,7,9)
                    6. <nShadowAtt> Menu Box shadow attribute
                    7. <nBarRow>    Row to start menu bar

  [aColumns] is an array of title column positions to
  override the internal 'figerin algorithm.

  Examples:
  ---------
   aOptions := { "Datafiles:Use Datafile",;
                 "Indices:Select Indices:Index order",;
                 "Editing:Replacement:Tabular Edit",;
                 "Reporting:Build Query:Print Lists",;
                 "Other:List file:Change Directory",;
                 "Quit" }

   aAttrib := { .t.,;               // draw the top bar box
                'W/B,GR/R,,,W/N',;  // top bar color
                'W/B,N/R,,,W/N',;   // drop box color
                cSingle_frame,;     // drop box frame
                3,;                 // drop box shadow position
                8,;                 // drop box shadow  attribute
                0 }                 // row # of menu bar

   nSel  := 1.01
   do while .t.
       nSel := PULLDN(nSel,aOptions,aAttrib)
       do case
       CASE nSel = 0  && TRAP 0
           nSel = 1.01
       case nSel = 1
       case nSel = 2
       case nSel = 3
       case nSel = 4
       endcase
   enddo

  Warnings:
  ----------
  It takes some work to start all options and titles
  with a first letter that is unique so that first letter selection may
  take place.

  Notes:
  -------
  First letter selection takes place on the following
  priority: next matching element first letter, next matching box
  title first letter.

  Passing a menu array element with title only will
  result in no menu box, with the title being the only selection
  and returning a selection value of <MENU>.1.
  (i.e. a 'Quit' box)

  Source:
  -------
  S_PULLDN.PRG

 

 

SP_POPREAD

()

  Short:
  ------
  POPREAD() Pops up a box with 1-5 say-get combinations

  Returns:
  --------
  nothing

  Syntax:
  -------
  POPREAD(lStacked,[nTop,nLeft,cColor],cSay,@expGet,cPicture...)

  Description:
  ------------
  [lStacked]   .t. = GETS are displayed below SAYS,
               .f. = GETS are displayed beside SAYS (default)

  [next 3 params may be option params - see below]

  For 1-5 iterations of  [cSay,@expGet,cPicture]  a
  popup window will display a Say <cSay>, do a Get on the variable
  passed by reference in <@expGet> with a Picture of <cPicture>. A
  read will then be issued.

  If params 2,3 and 4 are passed as Numeric/Numeric/Chr
  then they are evaluated as the top,left and color for the popup
  box.

  [nTop] = top
  [nLeft] = left
  [cColor] = color string

  Examples:
  ---------
   dDate := date()
   cTime := space(8)
   lFun  := .t.

   POPREAD(.t.,"Current Date",@dDATE,"@D",;
       "Current Time",@cTIME,"99:99:99",;
       "Having Fun ?",@lFUN,"Y")

  Notes:
  -------
  This is an intelligent version of ONE_READ. 2nd param
  is passed by reference rather than by name - cutting down
  DRASTICALLY on the macro expansion and greatly simplifying the
  code. To pass by reference, preface the parameter with @.

  Source:
  -------
  S_POPR.PRG