SP Menu Functions


SLOTUSMENU()   1-2-3 style menu
PULLDN()       Pulldown menu creator, handler
PSTABMENU()    Popup tabular (grid style) )menu
RAT_MENU2()    Mouseable MENU TO emulation
STABMENU()     Tabular (grid style) menu
MENU_V()       Vertical popup menu from variable # parameters
BUNGDROP()     Causes dropdown during BUNGEE() menu def sequence
BUNGEE()       Mouseable, multi-level dropdown menu with triggers
BUNGEND()      Ends a BUNGEE() menu array definition sequence
BUNGOPTION()   Adds option during a BUNGEE() menu definition sequence
BUNGSTART()    Starts a BUNGEE() menu array definition sequence
BUNGUNDROP()   Ends dropdown during BUNGEE() menu def sequence

 

SP_BUNGUNDROP

BUNGUNDROP()

  Short:
  ------
  BUNGUNDROP() Ends dropdown during BUNGEE() menu def sequence

  Returns:
  --------
  NIL

  Syntax:
  -------
  BUNGUNDROP()

  Description:
  ------------
  BUNGUNDROP() ends a dropdown during a BUNGEE() menu
  definition sequence.

  Use BUNGSTART(), BUNGEND(), BUNGOPTION(),
  BUNGDROP(), BUNGUNDROP() together to create a menu definition
  array for BUNGEE(). While it is not necessary to use these
  functions to create the array, it is helpful when you have
  a complex, multi-level dropdown structure.

  See BUNGEE for more information.

  Examples:
  ---------

  bungstart()

     bungoption("Files")
     bungdrop()
          bungoption("Open" ,{} ,{||!lFileIsOpen} )
          bungoption("Close",{||nil},{||lFileIsOpen } )
     bungundrop()
     bungoption("Edit")
     bungdrop()
          bungoption("DBF"  ,{||nil},nil )
          bungoption("Ascii",{||nil},nil )
     bungundrop()
     bungoption("Quit",{||bungeequit()},nil)

  aMenu := bungend()
  bungee(0,0,79,aMenu)

  Source:
  -------
  S_BUNGDEF.PRG

SP_BUNGSTART

BUNGSTART()
  Short:
  ------
  BUNGSTART() Starts a BUNGEE() menu array definition sequence

  Returns:
  --------
  NIL

  Syntax:
  -------
  BUNGSTART()

  Description:
  ------------
  BUNGSTART() initializes a BUNGEE() menu definition sequence.

  Use BUNGSTART(), BUNGEND(), BUNGOPTION(),
  BUNGDROP(), BUNGUNDROP() together to create a menu definition
  array for BUNGEE(). While it is not necessary to use these
  functions to create the array, it is helpful when you have
  a complex, multi-level dropdown structure.

  See BUNGEE for more information.

  Examples:
  ---------

  bungstart()

     bungoption("Files")
     bungdrop()
          bungoption("Open" ,{} ,{||!lFileIsOpen} )
          bungoption("Close",{||nil},{||lFileIsOpen } )
     bungundrop()
     bungoption("Edit")
     bungdrop()
          bungoption("DBF"  ,{||nil},nil )
          bungoption("Ascii",{||nil},nil )
     bungundrop()
     bungoption("Quit",{||bungeequit()},nil)

  aMenu := bungend()
  bungee(0,0,79,aMenu)

  Source:
  -------
  S_BUNGDEF.PRG

 

SP_BUNGREDRAW

BUNGREDRAW(

  Short:
  ------
  Redraws the current menu, with optional change of colors

  Returns:
  --------
  NIL

  Syntax:
  -------
  BUNGEETOP([aColors],[nShadowPos,[nShadowAtt])

  Description:
  ------------
  Redraws the current menu, with optional change of colors and shadows.
  The only time you would use this is to change colors and redraw the
  entire menu. [aColors] is the same as the parameter for BUNGEE() of
  the same name. You can also just use SETCOLOR() to change colors, and
  BUNGREDRAW() will parse out the colors it  needs for the menu. What this
  function does, is 1. Hide the menu 2. Reset the colors  3. Show the menu.

  [nShadowPos]    Optional shadow position for menu dropdown boxes.
                  Valid options are:
                       1. Lower left
                       3. Lower right
                       0. None
                  Upper left and upper right shadow positions are not
                  allowed. (they can overwrite parts of the menu bar)
                  Default is SLS_SHADPOS(), unless SLS_SHADPOS() is
                  upper left or upper right (7,9), in which case it
                  is set to 0 (none).

                  To force no shadows for the menu, pass 0.

                  Boxes may not always have shadows, if the shadow would
                  be drawn offscreen.

  [nShadowAtt]   Numeric shadow attribute. Default is SLS_SHADATT(), whose
                 default is 8. (grey on black)

  Examples:
  ---------
  bungstart()
          bungoption("Files")
          [etc...]
          bungoption("Colors",{||setcolors(),bungredraw()}  )
          [etc...]
    aMenu := bungend()

    bungee(0,0,79,aMenu)

  Source:
  -------
  S_BUNGEE.PRG

 

SP_BUNGOPTION

BUNGOPTION()
  Short:
  ------
  BUNGOPTION() Adds option during a BUNGEE() menu definition sequence

  Returns:
  --------
  NIL

  Syntax:
  -------
  BUNGOPTION(cPrompt,expAction,bActive)

  Description:
  ------------
  BUNGOPTION() adds an option during a BUNGEE() menu initialization
  sequence.

  [cPrompt] is the menu prompt, a character prompt, which is what will be
            displayed. i.e. "Files", "Edit". Imbed a tilde (~) to determine
            the trigger character which will be highlighted i.e.
            "Files","e~xit". The default trigger is the first letter.

            A specialized form of the character prompt is
            "CROSSBAR". If you include "CROSSBAR" as the text,
            a crossbar will be drawn joining the left and right sides of the
            dropdown box.

  [expAction] can be one of 3 things:
            1. a codeblock. this is simply evaluated
               when the option is selected
            2. An array (or nil) if the action is a dropdown box
               Creates a dropdown box when the prompt is selected.
               (this option must be then followed by a BUNGDROP()..
                BUNGUNDROP() sequence to define the dropdown menu. )
            3. NIL for CROSSBAR types

  [bActive] is the "is this option active?" codeblock
            This can either be NIL (always active)
            or is a codeblock which _must_ return type L
            (logical). This will determine if the prompt
            is active (available) or not (disabled). If disabled,
            the prompt is show in the disabled color.

  Use BUNGSTART(), BUNGEND(), BUNGOPTION(),
  BUNGDROP(), BUNGUNDROP() together to create a menu definition
  array for BUNGEE(). While it is not necessary to use these
  functions to create the array, it is helpful when you have
  a complex, multi-level dropdown structure.

  See BUNGEE for more information.

  Examples:
  ---------

  bungstart()

     bungoption("Files")
     bungdrop()
          bungoption("Open" ,{} ,{||!lFileIsOpen} )
          bungoption("Close",{||nil},{||lFileIsOpen } )
     bungundrop()
     bungoption("Edit")
     bungdrop()
          bungoption("DBF"  ,{||nil},nil )
          bungoption("Ascii",{||nil},nil )
     bungundrop()
     bungoption("Quit",{||bungeequit()},nil)

  aMenu := bungend()
  bungee(0,0,79,aMenu)

  Source:
  -------
  S_BUNGDEF.PRG

 

SP_BUNGEND

BUNGEND()

  Short:
  ------
  BUNGEND() Ends a BUNGEE() menu array definition sequence

  Returns:
  --------
  <aBungeeMenu> => a BUNGEE() menu array

  Syntax:
  -------
  BUNGEND()

  Description:
  ------------
  BUNGEND() ends a BUNGEE() menu definition sequence, returning
  a completed BUNGEE() menu array.

  Use BUNGSTART(), BUNGEND(), BUNGOPTION(),
  BUNGDROP(), BUNGUNDROP() together to create a menu definition
  array for BUNGEE(). While it is not necessary to use these
  functions to create the array, it is helpful when you have
  a complex, multi-level dropdown structure.

  See BUNGEE for more information.

  Examples:
  ---------

  bungstart()

     bungoption("Files")
     bungdrop()
          bungoption("Open" ,{} ,{||!lFileIsOpen} )
          bungoption("Close",{||nil},{||lFileIsOpen } )
     bungundrop()
     bungoption("Edit")
     bungdrop()
          bungoption("DBF"  ,{||nil},nil )
          bungoption("Ascii",{||nil},nil )
     bungundrop()
     bungoption("Quit",{||bungeequit()},nil)

  aMenu := bungend()
  bungee(0,0,79,aMenu)

  Source:
  -------
  S_BUNGDEF.PRG

 

SP_BUNGEETOP

BUNGEETOP()

  Short:
  ------
  Sends the current menu back to the top level box (not all
  the way to the top bar, but to the bar plus the current box)

  Returns:
  --------
  NIL

  Syntax:
  -------

  BUNGEETOP()

  Description:
  ------------
  Sends the current menu back to the top level box (not all
  the way to the top bar, but to the bar plus the current box)

  Examples:
  ---------
  bungstart()
  bungoption("Files")
  bungdrop()
     bungoption("Open" ,{} ,{||!lFileIsOpen} )
     bungdrop()
       bungoption("DBF" ,{||opendbf(),bungeetop()},nil )  // go back to top
       bungoption("Ascii",{||opendbf(),bungeetop()},nil )  // after these two
     bungundrop()
     bungoption("Close",{||nil},{||lFileIsOpen } )
  bungundrop()
  bungoption("Edit")
          bungoption("Quit",{||bungeequit()},nil)
  aMenu := bungend()

  bungee(0,0,79,aMenu)

  Source:
  -------
  S_BUNGEE.PRG

SP_BUNGEEQUIT

BUNGEEQUIT()                             *new*

  Short:
  ------
  BUNGEEQUIT( ) is how a Bungee menu is terminated. You would normally
  call it from one of the menu option codeblocks.

  Returns:
  --------
  NIL

  Syntax:
  -------

  BUNGEEQUIT()

  Description:
  ------------
  BUNGEEQUIT( ) is how a Bungee menu is terminated. You would normally
  call it from one of the menu option codeblocks.

  Examples:
  ---------
  bungstart()
  bungoption("Files")
  bungdrop()
          bungoption("Open" ,{} ,{||!lFileIsOpen} )
          bungoption("Close",{||nil},{||lFileIsOpen } )
  bungundrop()
  bungoption("Edit")
  bungdrop()
          bungoption("DBF"  ,{||nil},nil )
          bungoption("Ascii",{||nil},nil )
  bungundrop()
  bungoption("Quit",{||bungeequit()},nil)

  aMenu := bungend()

  @24,0 say "ALT-X=exit"   // set up Alt-X as a hotkey exit also
  aHotKeys := { {K_ALT_X,{||bungeequit()}}  }

  bungee(0,0,79,aMenu,nil,nil,nil,aHotKeys)

  Source:
  -------
  S_BUNGEE.PRG

 

SP_BUNGEE

BUNGEE()                             *new*

  Short:
  ------
  BUNGEE() Mouseable, multi-level dropdown menu with triggers

  Returns:
  --------
  NIL

  Syntax:
  -------

  BUNGEE(<nTop>,<nLeft>,<nRight>,<aMenu>,[aColumns],;
         [aColors],[aHotMice],[aHotKeys],[bExitCheck],;
         [lImmediate],[lDropped],[nHideLevel],[nShadowPos],;
         [nShadowAtt],[lHandleAlt] )

  Description:
  ------------
  Creates and activates a dropdown menu (bungee style)

  <nTop>          Row of menu bar
  <nLeft>         Left side of menu bar
  <nRight>        Right side of menu bar
  <aMenu>         A menu definition array of arrays

                  You  use the BUNGEE() menu array definition functions:
                  BUNGSTART(), BUNGEND(), BUNGOPTION(),BUNGDROP(),
                  BUNGUNDROP() together to create a menu definition array
                  for BUNGEE( ). This basically defines the menu options,
                  boxes and actions

  [aColumns]      An array of columns to determine the column
                  positions for the top bar options. Optional, as
                  this is automatically determined otherwise.

  [aColors]       An array of seven elements describing 6 colors
                  and the box drawing frame string

                  BACKGROUND COLOR         1
                  SELECTED OPTION COLOR    2
                  UNSELECTED OPTION COLOR  3
                  INACTIVE OPTION COLOR    4
                  SELECTED TRIGGER COLOR   5
                  UNSELECTED TRIGGER COLOR 6
                  BOX FRAME STRING         7   (as in "+-+|+-+| ")

                  Defaults are extracted from the current
                  values in SETCOLOR(), and adjusted to
                  account for trigger letters and inactive
                  colors.

  [aHotMice]      An array of hot areas where, should the
                  mouse click, a codeblock will be evaluated.
                  The array is an array of arrays, where each
                  sub-array is in the form:
                      {nTop,nLeft,nBottom,nRight,bCodeblock}
                  Where nTop..nRight refer to the screen
                  coordinates of the hot area.
                  i.e.
                  @24,0 say "<Help>"
                  aHotMice := { {24,0,24,5,{||dohelp}}  }

  [aHotKeys]      An array of hotkey values, which, if one of
                  the keys is pressed, a codeblock will be
                  evaluated on the spot.
                  The array is an array of arrays, where each
                  sub-array is of the form:
                      {nASCIIValue,bCodeblock}

                  @24,0 say "<Help>"
                  aHotKeys := { {K_F1,{||dohelp()}  }  }

  [bExitBlock]    This is a codeblock which returns a LOGICAL
                  which is evaluated before a menu exit is
                  allowed. If it returns .f., a menu exit will
                  not be allowed.
                  i.e. {||MESSYN("Really exit?")}

  [lImmediate]    Do mouse clicks or hot keys on options other
                  than current option cause an immediate action
                  request? Default = True

  [lDropped]      Should the menu start up in dropped mode (boxes
                  are already dropped from top bar) Default is
                  True.

  [nHideLevel]    This indicates the level to which the menu hides
                  itself when executing an option action, a mouse
                  hot button or a hot key.
                  0 - does not hide itself at all
                  1 - hides everything except the top bar  (default)
                  2 - hides everything

  [nShadowPos]    Optional shadow position for menu dropdown boxes.
                  Valid options are:
                       1. Lower left
                       3. Lower right
                       0. None
                  Upper left and upper right shadow positions are not
                  allowed. (they can overwrite parts of the menu bar)
                  Default is SLS_SHADPOS(), unless SLS_SHADPOS() is
                  upper left or upper right (7,9), in which case it
                  is set to 0 (none).

                  To force no shadows for the menu, pass 0.

                  Boxes may not always have shadows, if the shadow would
                  be drawn offscreen.

  [nShadowAtt]   Numeric shadow attribute. Default is SLS_SHADATT(), whose
                 default is 8. (grey on black)

  [lHandleAlt]   Allow ALT+trigger letter combinations (ALT-A through ALT-Z)
                 to select menu options

  Examples:
  ---------

  (Also see S3META2.PRG in the sample files for a good example)

  bungstart()
  bungoption("Files")
  bungdrop()
          bungoption("Open" ,{} ,{||!lFileIsOpen} )
          bungoption("Close",{||nil},{||lFileIsOpen } )
  bungundrop()
  bungoption("Edit")
  bungdrop()
          bungoption("DBF"  ,{||nil},nil )
          bungoption("Ascii",{||nil},nil )
  bungundrop()
  bungoption("Quit",{||bungeequit()},nil)

  aMenu := bungend()

  @24,0 say "[ALT-X=exit]"   // set up Alt-X as a hotkey exit also
  aHotKeys := { {K_ALT_X,{||bungeequit()}           }
  aHotMice := {  {24,0,24,11,{||bungeequit()}     }  }

  bungee(0,0,79,aMenu,nil,nil,aHotMice,aHotKeys, { ||messyn("Exit now?") }   )

  Example 2
  ---------

  bungstart()
  bungoption("Next",{||dbskip(1)})
  bungoption("Prev",{||dbskip(-1)})
  bungoption("Edit",{||doedit()})
  bungoption("Add ",{||doadd()})
  bungoption("Delete",{||dodelete()})
  bungoption("Table",{||editdb(.t.)})
  bungoption("Search")
       bungdrop()
       bungoption("Field Search",{||searchme()} )
       bungoption("Key Search",{||SPOPSEEK()} )
       bungoption("Query ",{||query()} )
       bungundrop()
  bungoption("Memo")
       bungdrop()
       bungoption("View",{||viewmemo()} )
       bungoption("Edit",{||editmemo()} )
       bungundrop()
  bungoption("Hardcopy")
       bungdrop()
       bungoption("Record",{||hcrecord()})
       bungoption("Memo",{||hcmemo()})
       bungundrop()
  bungoption("Quit",{||bungeequit()},nil)

  aMenu := bungend()
  bungee(0,0,79,aMenu)

  Notes:
  ------
  Notes: Dropdown boxes will adjust for 'too far right' or 'too far down',
  but there is no adjustment for 'too many options in the box to fit on
  screen'

---------------------------------------------------------------------
  Source:
  -------
  S_BUNGEE.PRG, S_BUNGDE.PRG

 

SP_BUNGDROP

BUNGDROP()

  Short:
  ------
  BUNGDROP() Causes dropdown during BUNGEE() menu def sequence

  Returns:
  --------
  NIL

  Syntax:
  -------
  BUNGDROP([nDown],[nOver])

  Description:
  ------------
  BUNGDROP() causes a dropdown to occur during a BUNGEE() menu
  definition sequence. This is followed by a series of BUNGOPTION()
  and then BUNGUNDROP() to end the dropdown.

  [nDown] Number of rows down from row of current option (default 1)
  [nOver] Number of columns over from column of current option
          (default is 0 for bar options, 1 for dropdown options)

  Use BUNGSTART(), BUNGEND(), BUNGOPTION(),
  BUNGDROP(), BUNGUNDROP() together to create a menu definition
  array for BUNGEE(). While it is not necessary to use these
  functions to create the array, it is helpful when you have
  a complex, multi-level dropdown structure.

  See BUNGEE for more information.

  Examples:
  ---------

  bungstart()

     bungoption("Files")
     bungdrop()
          bungoption("Open" ,{} ,{||!lFileIsOpen} )
          bungoption("Close",{||nil},{||lFileIsOpen } )
     bungundrop()
     bungoption("Edit")
     bungdrop()
          bungoption("DBF"  ,{||nil},nil )
          bungoption("Ascii",{||nil},nil )
     bungundrop()
     bungoption("Quit",{||bungeequit()},nil)

  aMenu := bungend()
  bungee(0,0,79,aMenu)

  Source:
  -------
  S_BUNGDEF.PRG