
Click above to get retro games delivered to your door ever month!
X-Hacker.org- Mouse interface routines - <b>button()</b>
[<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
BUTTON()
Make a mouse button on screen with associated function key
------------------------------------------------------------------------------
Syntax
Button(<nTop>, <nLeft>, <nBottom>, <nRight>, <xString>,;
<nFunctionKey>, <xAction>, <nMouseSystem>, <nButton>,;
<nSleep>, <lRelease>, <cColor> ) -> <aId>
Arguments
<nTop>, <nLeft>, <nBottom>, <nRight> are coordinates to include
in hot spot and to clear to put string
<xString> is either a character string to print or a code block
which will print the button on the screen. It is centered
in the area defined above.
<nFunctionKey> is the function key (as defined in inkey.ch) to be
associated with this button. Can be NIL
<bAction> is a code block to be associated with this button.
<nMouseSystem> is the mouse system to place the hot spot into. The
values are defined in MOUSE.CH and are MREAD, MBROWSE, MMENU,
MMEMOEDIT, MACHOICE, MGENERAL
<nButton> - Optional button number for action to occur. IF
equal to 0 or NIL, the action occurs on
clicking any button (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 presse2s.
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())
<cColor> is the the color for button. If blank then current color
used.
Returns
<aId> which is a unique identifier of the button. It is not the same
as the ids produced by the individual hotspot routines so do not
use them for that purpose.
Description
This routine provides a simple method of associating a screen hot
spot and a function key to a given action.
The screen area behind the button is saved.
Examples
aId1=Button(0,0,0,6,"Help",K_F1,{|| MyHelp()},MREAD,"W/N")
Header File: MOUSE.CH
Source: MBUTTON.PRG
Author: Leo Letendre
See Also: RemoveButton() ButtonCool() ButtonWarm()
Online resources provided by: http://www.X-Hacker.org --- NG 2 HTML conversion by Dave Pearson