Method mouse.clickEx(+ 4 overloads)
Overload
Clicks, double-clicks, presses or releases a mouse button at position x y relative to window w.
public static MRelease clickEx(MButton button, wnd w, Coord x = default, Coord y = default, bool nonClient = false)
Parameters
button (MButton)
Button and action. Default: left click. |
w (wnd)
Window or control. |
x (Coord)
X coordinate relative to the client area of w. Default - center. Examples: |
y (Coord)
Y coordinate relative to the client area of w. Default - center. |
nonClient (bool)
The specified position is relative to the window rectangle, not to its client area. |
Returns
Exceptions
ArgumentException
Invalid button flags (multiple buttons or actions specified). |
AuWndException
|
ArgumentOutOfRangeException
The position is not in screen. No exception if option Relaxed is |
AuException
Failed to move the cursor to that position. Some reasons:
|
InputDesktopException |
Remarks
To move the mouse cursor, calls mouse.move.
If after moving the cursor it is not in the window (or a window of its thread), activates the window (or its top-level parent window). Throws exception if then x y is still not in the window. Skips all this when just releasing button or if option Relaxed is true
. If w is a control, x y can be somewhere else in its top-level parent window.
Uses opt.mouse: OMouse.MoveSpeed, OMouse.MoveSleepFinally (between moving and clicking), OMouse.ClickSpeed, OMouse.ClickSleepFinally, OMouse.Relaxed.
Examples
mouse.clickEx(MButton.Middle, w1, 695, 110);
mouse.clickEx(MButton.Right | MButton.Down, w1, 695, 110);
mouse.clickEx(MButton.Right | MButton.Up, w1, 695, 110);
Overload(next)
Clicks, double-clicks, presses or releases a mouse button at position x y relative to UI object obj.
public static MRelease clickEx(MButton button, MObject obj, Coord x = default, Coord y = default)
Parameters
button (MButton)
Button and action. Default: left click. |
obj (MObject)
Can be wnd, elm (elm.MouseClick), uiimage (uiimage.MouseClick), screen, RECT in screen, RECT in window, mouse.lastXY ( |
x (Coord)
X coordinate relative to obj. Default - center. Examples: |
y (Coord)
Y coordinate relative to obj. Default - center. |
Returns
Exceptions
ArgumentException
Invalid button flags (multiple buttons or actions specified). |
AuWndException
|
ArgumentOutOfRangeException
The position is not in screen. No exception if option Relaxed is |
AuException
Failed to move the cursor to that position. Some reasons:
|
InputDesktopException |
Exception
Other exceptions. Depends on obj type. |
Remarks
To move the mouse cursor, calls mouse.move.
If after moving the cursor it is not in the window (or a window of its thread), activates the window (or its top-level parent window). Throws exception if then x y is still not in the window. Skips all this when just releasing button or if option Relaxed is true
. If w is a control, x y can be somewhere else in its top-level parent window.
Uses opt.mouse: OMouse.MoveSpeed, OMouse.MoveSleepFinally (between moving and clicking), OMouse.ClickSpeed, OMouse.ClickSleepFinally, OMouse.Relaxed.
Overload(next)
Clicks, double-clicks, presses or releases a mouse button at the specified position in screen.
public static MRelease clickEx(MButton button, Coord x, Coord y)
Parameters
button (MButton)
Button and action. Default: left click. |
x (Coord)
X coordinate in the screen. Examples: |
y (Coord)
Y coordinate in the screen. |
Returns
Exceptions
ArgumentException
Invalid button flags (multiple buttons or actions specified). |
ArgumentOutOfRangeException
The position is not in screen. No exception if option Relaxed is |
AuException
Failed to move the cursor to that position. Some reasons:
|
InputDesktopException |
Remarks
Uses opt.mouse: OMouse.ClickSpeed, OMouse.ClickSleepFinally and those used by mouse.move.
Overload(next)
Clicks, double-clicks, presses or releases a mouse button at the specified position in screen.
public static MRelease clickEx(MButton button, POINT p)
Parameters
button (MButton)
Button and action. Default: left click. |
p (POINT)
Coordinates. Tip: To specify coordinates relative to the right, bottom, work area or a non-primary screen, use Coord.Normalize, like in the example. |
Returns
Exceptions
ArgumentException
Invalid button flags (multiple buttons or actions specified). |
ArgumentOutOfRangeException
The position is not in screen. No exception if option Relaxed is |
AuException
Failed to move the cursor to that position. Some reasons:
|
InputDesktopException |
Remarks
Uses opt.mouse: OMouse.ClickSpeed, OMouse.ClickSleepFinally and those used by mouse.move.
Examples
Click at 100 200.
mouse.clickEx(MButton.Left, (100, 200));
Right-click at 50 from left and 100 from bottom of the work area.
mouse.clickEx(MButton.Right, Coord.Normalize(50, ^100, workArea: true));
Overload(top)
Clicks, double-clicks, presses or releases a mouse button. By default does not move the mouse cursor.
public static MRelease clickEx(MButton button = MButton.Left, bool useLastXY = false)
Parameters
button (MButton)
Button and action. Default: left click. |
useLastXY (bool)
Use mouse.lastXY. It is the mouse cursor position set by the most recent "mouse move" or "mouse click" function called in this thread. Use this option for reliability.
Example: |
Returns
Exceptions
ArgumentException
Invalid button flags (multiple buttons or actions specified). |
Exception
If lastXY |
InputDesktopException |
Remarks
Uses opt.mouse: OMouse.ClickSpeed, OMouse.ClickSleepFinally and maybe those used by mouse.move.