SP_SLOTUSMENU

SLOTUSMENU()

  Short:
  ------
  SLOTUSMENU() 1-2-3 style menu

  Returns:
  --------
  <expReturn> => depends on several factors

  Syntax:
  -------
  SLOTUSMENU(nTop,nLeft,nBottom,nRight,aOptions,[lBox],;
        [lSaveRest],[lReset])

  Description:
  ------------
  Draws a 1-2-3 style menu from <nTop>,<nLeft> to
  <nTop+1>,<nRight>.

  <nTop> is the menu option line. <nTop+1> is the
  message line.

  <aOptions> is an array of arrays in the format:

  {  {cOption,cMessage,expAction},
  {cOption,cMessage,expAction},... }

  where <cOption> is the option prompt, <cMessage> is
  the option message, and <expAction> is the option action.

  <expAction> may be of three types:

      1.    a codeblock, in which case it is executed on
            ENTER

      2.    a submenu array of the form:

         {  {cOption,cMessage,expAction},  ;
             {cOption,cMessage,expAction},... }
            which is displayed on ENTER. Pressing ESCAPE
            from the submenu returns to the prior menu.

            The submenu <expaction> may be a codeblock,
            another subarray, or any other value, etc.
            Thus nesting can go as deep as you like.

      3.    any other value, which is returned to the
            calling program on ENTER.

  Pressing ESCAPE from the main menu returns 0

  [lBox]  If True, the menu is drawn inside of a popup
  box. Actual dimensions of the menu area then become
  <nTop>+1,<nLeft>+1 to <nTop>+2,<nRight>-1. Default is False - no box.

  [lSaveRest] If True, the underlying screen is saved
  and restored on entrance/exit. Default is False - no restore.

  [lReset] If True, the menu is reset to first option
  on exit. Default is False - menu remembers where it was.

  SLOTUSCLEAR() resets the menu.

  Examples:
  ---------

   proc test
   local nReturn := 0
   local aMain := {}
   local aSub1 := {{"Pizza",     "Eat Pizza", {||pizza()}},;
                   {"Spaghetti", "Eat Spaghetti", {||spagett()}},;
                   {"Tortellini","Eat Tortellini", {||tortellini()}} }

   local aSub2 := {{"Steak",     "Eat Steak", {||steak()}},;
                   {"Hamburger", "Eat Hamburger",  {||burgers()}},;
                   {"Chili Dog", "Eat Chili Dog",  {||burntwice()}}  }

   aadd(aMain,{"Italian","Eat Italian food",aSub1})
   aadd(aMain,{"American","Eat American food",aSub2})
   aadd(aMain,{"Quit","Just not hungry - Quit",0})
   aadd(aMain,{"Relief","Already ate - need Alka Seltzer",{||alka()} })

   SLOTUSMENU(0,0,0,79,aMain,.t.,.t.,.t.)

   SLOTUSCLEAR()  // !! always use this to clear the menu

  Notes:
  -------

  Always use SLOTUSCLEAR() after calling SLOTUSMENU()

  Source:
  -------
  S_LOTMEN.PRG

 

SP_RAT_MENU2

RAT_MENU2()

  Short:
  ------
  RAT_MENU2() Mouseable MENU TO emulation

  Returns:
  --------
  <nSelected> => selected menu option, 0 for none

  Syntax:
  -------
  RAT_MENU2(aOptions,[nStart],[lImmediate],[bMouse])

  Description:
  ------------
  You must pass an array of arrays, with each element
  being an array in the form {nRow,nColumn,cPrompt} which
  correspond to      [ @nRow,nCol PROMPT cPrompt. ]

  [nStart] is an optional starting prompt, with the
  default being 1

  [lImmediate] refers to the action taken when a first
  letter or a mouse click changes options. The default is to have
  immediate action - select and return. By passing False, it
  becomes a 2 step  process, requiring click-click or
  firstletter-firstletter to select and return.

  [bMouse] is an optional codeblock for mouse clicks. If the
  mouse click does not satisfy RAT_MENU2(), and there is a
  [bMouse] codeblock, it will be evaluated as follows:

               eval(bMouse,mouserow, mousecol)

  Examples:
  ---------
   local aOptions := { ;
                      {23,2 ,  'Add'},;
                      {23,9 ,  'Open'},;
                      {23,17 , 'Delete'},;
                      {23,27 , 'Change Date'},;
                      {23,42 , 'Output list'},;
                      {23,57 , 'Purge '},;
                      {23,74 , 'Quit'}}

   nSelected := RAT_MENU2(aOptions,4,.f.,{|r,c| checkmouse(r,c) })

  Source:
  -------
  S_RMENU2.PRG

See Also : RAT_ELBHD(), RAT_EQMCOL(), RAT_EQMROW(), RAT_ERBHD(), RAT_EVENT(), 
           RAT_ISMOUSE(), RAT_LASTEV(), RAT_READ()

SP_MENU_V

MENU_V()

  Short:
  ------
  MENU_V() Vertical popup menu from variable # parameters

  Returns:
  --------
  <nSelection> => selection - 0 for no selection

  Syntax:
  -------
  MENU_V(cTitle,cOption1,[cOption2,...cOption16])

  Description:
  ------------
  Creates a popup vertical menu in a centered box,
  using <cTitle> as the title, and performing a menu to on
  <cOption1...cOption16> (variable #)

  <cTitle> may be passed as "" for no title.

  [cOption2..cOption16] are optional

  Examples:
  ---------
   nChoice :=  menu_v("Selection","Edit","Add","Quit")

       -or-

   nChoice :=  menu_v("","Edit","Add","Quit")

  Source:
  -------
  S_MENUV.PRG

 

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