Description: This function returns an indication of whether or not the mouse pointer is within a specified screen area and a particular button combination is being pressed.
Returns: Boolean
Usage: Steady State
Format: Click(X1, Y1, X2, Y2, Button)
Parameters: X1 { numeric } { required } { no default: }
Any numeric expression giving the X coordinate on the screen of one side of the screen area ("target").
Y1 { numeric } { required } { no default: }
Any numeric expression giving the Y coordinate on the screen of either the top or bottom of the screen area ("target").
X2 { numeric } { required } { no default: }
Any numeric expression giving the X coordinate on the screen of the side of the "target" opposite to X1.
Y2 { numeric } { required } { no default: }
Any numeric expression giving the Y coordinate on the screen of either the top or bottom of the "target", whichever is the opposite to Y1.
Button { numeric } { required } { no default: }
Any numeric expression giving the locator button combination that will cause the Click function to return a true value when the locator cursor is within the "target" screen area. The codes for this parameter are as follows:
|
Button |
Button Locator |
|
0 |
No buttons |
|
1 |
Right button |
|
2 |
Middle button |
|
3 |
Right and middle buttons |
|
4 |
Left button |
|
5 |
Left and right buttons |
|
6 |
Left and middle buttons |
|
7 |
All three buttons |
If the value is:
multiplied by 8: the meaning for multiple buttons pressed becomes "OR", rather than "AND". For example, to accept any button on a 2 or 3 button mouse, use 56 (8 * 7); to accept the left mouse button, regardless of whether or not the right button is pressed, use 32 (8 * 4).
increased by 64: the function will become true when the mouse buttons are released, rather than when they are pressed.
increased by 128: the buttons must be double-clicked
Comments: This function returns true if the locator position is within the boundaries of the "target" as defined by (X1,Y1) - (X2,Y2), and the locator button value matches the Button parameter. If the locator is not installed, the function will return false (0).
The Click function is a level sensitive function, which means that the mouse button(s) must be pressed when the function is executed or it will return false. This means that a brief press of a mouse button with the cursor in the correct target area might not be picked up by the Click function if the system is heavily loaded. Use of the Pick function may be used in most situations to alleviate this problem.
Note that if Click is used as a action trigger it will not reset; the action will continue to trigger as fast as possible as long as the Click is true. This is different from Pick, which would trigger once and be reset by the action trigger.
Example:
Box(100, 500, 500, 900 { Coordinates for the box },
1 { Solid style },
Cond(Click(100, 500, 500, 900, 56
{ Test if button pressed in area }),
15 { Color is white },
7 { Color is light gray }),
1 { Width in screen coordinates });
This draws a gray box on the screen. If the mouse button is inside the square and any button combination is held down, the box will turn white. If the mouse should move outside the box, or if all buttons are released, the Box color will turn back to gray. Note that the Box coordinates and the coordinates for the Click function are the same by choice - they are not required to match. That is, the coordinates in the Box specify where to draw the box, and the coordinates in the Click specify where to look for a mouse click.
See Also:
LocSwitch | Pick | SetXLoc | SetYLoc | Target | WinLocSwitch | WinXLoc | WinYLoc | XLoc | YLoc