
Click above to get retro games delivered to your door ever month!
X-Hacker.org- Mouse interface routines - <b>ghotspot()</b>
[<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
GHOTSPOT()
Defines Mouse Hot spots for all mouse subsystems
------------------------------------------------------------------------------
Syntax
GHotSpot( <nTopRow>, <nLeftCol>, <nBotRow>, <nRightCol>, <bAction>, ;
<nButton>, <nSleep>, <lRelease>) -> <nId>
Arguments
<nTopRow> - the top row of the area
<nLeftCol> - the left column of the area
<nBotRow> - the bottom row of the area
<nRightCol> - the right column of the area
<bAction> - Code block which will be executed when
mouse is clicked in the area
<nButton> - Optional button number for action to occur. IF
equal to 0 or NIL, the action occurs on
clicking anybutton (the code block can decide
what to do with based upon the button). If equal
to 1, code block executes only on left click,
if equal to 2 only on right click and if equal
to 4(?) then the middle button.
<nSleep> - Optional value of a minimum time (in seconds) to
wait between servicing multiple button presses.
Prevents routine from operating too quickly and
reading the press of a button multiple times
when not intended. If =NIL then the default value
is used (see MDefSleep()).
<lRelease> - Optional Logical Value. If set to .T. the
servicing routine will pause after the completion
of bAction for the release of the mouse button(s)
Useful for guaranteeing no multiple hits on
an area. If =NIL then the default is used (see
MDefRelease())
Returns
nId which is an ID to be used to remove the area with a call
to RemHotSpot(nId)
Description
This routine defines a hot spot for all mouse subsytems, which will
be activated if the user clicks the mouse in the defined area. The
action which is executed is defined by the code block bAction which
is called with five arguments:
nButNum: the number of the button pressed with
1=left, 2=right, 4=middle(?).
nRow: The row that the mouse cursor was in when it
was clicked
nCol: The column that the mouse cursor was in when it
was clicked
nTime: The time returned by SECOND() shortly after the
button was clicked.
nId: The hot spot Id number.
Thus the code block should have a form similar to the following
if one wishes to use the button/cursor information:
{|nButNum, nRow, nCol, nTime, nId| MyFunc(NButNum,nRow,nCol,nTime,nId)}
Examples
GHotSpot(1,10,1,20,{|| ShowHelp()},1,,.T.) // hot spot shows help
Source: MOUSFUNC.PRG
Author: Leo Letendre
See Also: GCOOLSPOT() GWARMSPOT() GREMHOTSPOT()
Online resources provided by: http://www.X-Hacker.org --- NG 2 HTML conversion by Dave Pearson