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 Event Functions

 RAT_EVENT()    Event handler - inkey() with mouse awareness
 RAT_ERBHD()    Determines if right mouse button is held down
 RAT_ISMOUSE()  Determines mouse usage by RAT_EVENT()
 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
 IFMOUSEHD()    Checks if mouse held down,evals codeblock while it is
 ISMOUSEAT()    Checks for mouse click within passed coordinates
 MBRZCLICK()    Checks for mouse click on current Tbrowse row/col
 MBRZMOVE()     Checks for mouse click at and moves to Tbrowse row/col
 MOUSEHOTAT()   Checks for mouse click from array of hot coordinates
 RAT_LASTEV()   Returns the last event recorded by RAT_EVENT()
 R_ISRATREAD()  Determines if RAT_READ() is current get system

 

SP_RAT_LASTEV

RAT_LASTEV()

  Short:
  ------
  RAT_LASTEV() Returns the last event recorded by RAT_EVENT()

  Returns:
  --------
  <nEvent> => last recorded RAT_EVENT() event

  Syntax:
  -------
  RAT_LASTEV()

  Description:
  ------------
  Every once in a while, some other function will be responsible
  for doing the RAT_EVENT() call, but your function still wants
  to know what the last event was. This function can be used to
  retrieve that value.

  Examples:
  ---------
   RAT_LASTEV()

  Source:
  -------
  S_MOOSE.PRG

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

 

SP_RAT_ISMOUSE

RAT_ISMOUSE()

  Short:
  ------
  RAT_ISMOUSE() Determines mouse usage by RAT_EVENT()

  Returns:
  --------
  <lIsMouse> => is there a mouse

  Syntax:
  -------
  RAT_ISMOUSE([lIsMouse])

  Description:
  ------------
  Determines mouse usage by RAT_EVENT(). Default is
  determined by a call to the ASM function RAT_EXIST(). However,
  you may want to shut down mouse usage even if a mouse is
  present. If so, call this function with False, to override.

  [lIsMouse]  S_MOOSE.PRG contains a static variable
  called 'lIsMouse'. This is determined initially by a call to
  RAT_EXIST(), but may be overridden by calling RAT_ISMOUSE(.f.).

  Examples:
  ---------
   RAT_ISMOUSE(.f.).

  Source:
  -------
  S_MOOSE.PRG

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

SP_RAT_EVENT

RAT_EVENT()

  Short:
  ------
  RAT_EVENT() Event handler - inkey() with mouse awareness

  Returns:
  --------
  <nEvent> => Event value - either inkey() value or
  mouse value

  Syntax:
  -------
  RAT_EVENT([nTimeout],[lClearkb])

  Description:
  ------------
  Event handler - inkey() with mouse awareness

  <nTimeout>   is the   # seconds to wait before
  timeout. Zero (0) means indefinately . If you don't pass
  anything, default is 0. Slight difference from inkey() there.

  Returns values are:

     If keystroke                                   inkey() value
     If left mouse button has been depressed        K_MOUSELEFT
     If right mouse button has been depressed       500
     If timeout                                      0

  [lClearkb]   optional clear keyboard True (default)
  or False. If a keystroke is gotten, and this is True, clear the
  keyboard with:
                     while inkey()#0
                     end

  Examples:
  ---------
   e := 0

   while  e#27
      e := rat_event(30)
      do case
      case e == 0
        ? "Timed out after 30 seconds"
      case e < 400
        ? "Key press with inkey() value of :",e
      case e == 400
        ? "Left mouse button pressed at :"
        ?? "row-> ",rat_eqmrow(),  "col-> ",rat_eqmcol()
      case e == 500
        ? "Right mouse button pressed at :"
        ?? "row-> ",rat_eqmrow(),  "col-> ",rat_eqmcol()
      endcase
   end

  Source:
  -------
  S_MOOSE.PRG

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

SP_RAT_EQMROW

RAT_EQMROW()

  Short:
  ------
  RAT_EQMROW() Returns mouse row at last press

  Returns:
  --------
  <nRow> => mouse row at last button press (left or
  right)

  Syntax:
  -------
  RAT_EQMROW()

  Description:
  ------------
  Returns mouse row at last press (LEFT OR RIGHT).
  S_MOOSE.PRG has two static variables, 'mouserow' and 'mousecol'.
  These are set each time RAT_EVENT() determines that the mouse
  has been depressed.

  Examples:
  ---------
   e := 0

   while e#27
      e := rat_event(30)
      do case
      case e == 0
        ? "Timed out after 30 seconds"
      case e < 400
        ? "Key press with inkey() value of :",e
      case e == 400
        ? "Left mouse button pressed at :"
        ?? "row-> ",rat_eqmrow()
        ?? "col-> ",rat_eqmcol()
      case e == 500
        ? "Right mouse button pressed at :"
        ?? "row-> ",rat_eqmrow()
        ?? "col-> ",rat_eqmcol()
      endcase
   end

  Source:
  -------
  S_MOOSE.PRG

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