SP Mice implementation

Mice and SuperLib

 SuperLib contains a set of mouse and event functions.
 These functions are MOSTLY prefaced with 'RAT' for uniqueness.

 The basic functions are written in assembler (MASM
 5.10) and are in s_mouse.asm. These provide such things as
 testing for a mouse, turning the mouse cursor on, turning it off,
 positioning it.

 Also provided are two approaches to knowing where the
 mouse is and what it is doing. The first is a direct query of
 the mouse's status and position. This is basically, "where is the
 mouse right now, is the right button depressed right now, is the
 left button depressed right now". These are accomplished through
 service 3 of interrupt 33h.

 The second approach is to use service 5 of interrupt
 33h, which 'records' right and left mouse button depresses and
 where the mouse was when these occurred.

 These Clipper functions, contained in s_moose.prg,
 are included to provide a simple event manager to trap both keys
 and mouse events and store them for reference.

 The event manager RAT_EVENT() can be used in place of
 inkey(), and will detect a keypress, a mouse left button press,
 a mouse right button press, or a timeout. The 'event' returns a
 value similiar to inkey(), but adds values of 400 and 500 for
 mouse right and left presses. Functions are provided to find out
 the mouse row and column when the event occurred.

 Two additional functions RAT_READ() and RAT_MENU2()
 are provided which use the mouse and event functions to perform
 a read and a menu to emulation. These are also good examples for
 usage of the mouse and event functions.

 All SuperLib functions are mouse aware, as of version 3.5.

 

SP Mouse Functions

 RAT_ELBHD()    Determines if left mouse button is held down
 RAT_EQMCOL()   Returns mouse column at last press
 RAT_EQMROW()   Returns mouse row at last press
 RAT_ERBHD()    Determines if right mouse button is held down
 RAT_EVENT()    Event handler - inkey() with mouse awareness
 RAT_ISMOUSE()  Determines mouse usage by RAT_EVENT()
 RAT_LASTEV()   Returns the last event recorded by RAT_EVENT()
 RAT_MENU2()    Mouseable MENU TO emulation
 RAT_READ()     Mouseable read
 RAT_AREA()     Limits the mouse to a rectangular area of the screen
 RAT_COL()      Current mouse column
 RAT_COLL()     Returns mouse column at the last left button press
 RAT_COLR()     Returns mouse column at the last right button press
 RAT_EXIST()    Determines if a mouse is available
 RAT_FORCE()    This forces a mouse present status, regardless
 RAT_LBHD()     Determines if the mouse left button is currently depressed
 RAT_LEFTB()    Determines if the left mouse button has been pressed
 RAT_NOMOUSE()  This forces a no mouse status, regardless
 RAT_OFF()      Sets the mouse cursor off
 RAT_ON()       Sets the mouse cursor on
 RAT_POSIT()    Positions the mouse cursor at row,column
 RAT_RBHD()     Determines if the mouse right button is currently depressed
 RAT_RESET()    Resets the mouse to its default values
 RAT_RIGHTB()   Determines if the right mouse button has been pressed
 RAT_ROW()      Current mouse row
 RAT_ROWL()     Returns mouse row at the last left button press
 RAT_ROWR()     Returns mouse row at the last right button press

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_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()