Phantom Documentation

[Help Home] [Phantom Home]
MouseClick

window.MouseClick(int iButton, int ix, int iy, int iType);

Applicable Classes: MainWin

Parameters:
int iButton - The mouse button to click - see Description
int ix - The x-coordinate location to click (relative to the top left of the window)
int iy - The y-coordinate location to click (relative to the top left of the window)
int iType - The type of mouse click to perform - see Description
Return Value: None

Description:
Moves the mouse to the location specified by ix and iy and clicks one of the mouse buttons.  The button and type of click are indicated by the iButton and iType parameters, respectively.

The options for the iButton parameter are as follows:            

            0 = Left Button
            1 = Middle Button
            2 = Right Button            

The options for the iType parameter are as follows:

            0 = Mouse button Click (up and down)
            1 = Mouse button Down
            2 = Mouse button Up
            3 = Mouse button Double Click

For example, a call to this function with iButton = 2 and iType = 1 would simulate holding down the right button.  The button would stay down until another MouseClick function is called.

To simulate mouse clicks relative to the screen, see the MouseClick general function.


Example Code

# Include Phantom Target Declarations
use "PhantomTarget.dec";
System("PhantomTarget.exe");

# Move the client window using mouse-click and mouse-move
# The -5 is because it is with respect to the client
# area of the child window (which does not include
# the title bar).
PhantomTarget.MDIClient1.Untitled.MouseClick(0, 100, -5, 1);
PhantomTarget.MDIClient1.Untitled.MouseMove(200, 200);
PhantomTarget.MDIClient1.Untitled.MouseClick(0, 100, -5, 2);

# Open the button window
PhantomTarget._Controls.Pus_hButton.Select();

# Use MouseClick (instead of just Click) to
# click the OK button.
Button.OK.MouseClick(0, 3, 3, 0);

# Exit out
PhantomTarget.Close();




See Also: MainWin Functions



Copyright 2000-2011 Phantom Automated Solutions