Click

(Engine-Level Function)

Description:

The Click function returns a Boolean TRUE if the click happens within a target area and the click is done with specified button combination.

Returns: Boolean
Usage: Steady State only.
Function Groups: Graphics,  Locator,  Window
Related to: LocSwitch | Pick | SetXLoc | SetYLoc | Target | WinLocSwitch | WinXLoc | WinYLoc | XLoc | YLoc
Format: Click(X1, Y1, X2, Y2, Button)
Parameters:  
X1
Required. Any numeric expression giving the X coordinate on the screen of one side of the screen area ("target").
Y1
Required. Any numeric expression giving the Y coordinate on the screen of either the top or bottom of the screen area ("target").
X2
Required. Any numeric expression giving the X coordinate on the screen of the side of the "target" opposite to X1.
Y2
Required. 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

Required. 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 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 the Pick() function for action triggers, rather than Click().

If Click is used as an 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, 100 { Coordinates for the box },
       1 { Solid style },
       5 { Width in screen coordinates },
       Cond(Click(100, 500, 500, 100, 56 { Color depends on click }),
            12 { Color is red when clicked     },
            7  { Color is light gray otherwise })
      );

This draws a blue 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.