MOUSE Command

Performs the equivalent of clicking, double-clicking, or moving the mouse, or performs a drag operation.

MOUSE [CLICK | DBLCLICK] [AT nRow1, nColumn1]
| DRAG TO nRow2, nColumn2, nRow3, nColumn3 ...][PIXELS]
[WINDOW cWindowName][LEFT | MIDDLE | RIGHT][SHIFT] [CONTROL] [ALT]

Parameters

  • CLICK | DBLCLICK
    Specifies that the mouse is clicked or double-clicked. If you omit the AT clause, the mouse is clicked or double-clicked at the current mouse pointer position.

  • AT nRow1, nColumn1
    Specifies where the mouse is clicked, double-clicked, or the position to which the mouse pointer is moved. If you omit CLICK or DBLCLICK, the mouse pointer is moved to the position specified with nRow1, nColumn1.

    Unless you specify a WINDOW, the position specified by nRow1, nColumn1 is relative to the main Microsoft Visual FoxPro window, and the position is determined by the font of the main Visual FoxPro window. Most fonts can be displayed in a wide variety of sizes, and some are proportionally spaced. A row corresponds to the height of the current font; a column corresponds to the average width of a letter in the current font.

    You cannot use the AT clause to choose a Visual FoxPro menu title. Use SYS(1500) – Activate a System Menu Item instead to choose a menu title.

  • DRAG TO nRow2, nColumn2, nRow3, nColumn3 ...]
    Specifies that the mouse pointer is dragged to a position or a set of positions.

    When the mouse pointer is dragged, a mouse button is pressed and held down until the mouse pointer reaches the destination position; then the mouse button is released. If you omit the LEFT, MIDDLE, and RIGHT clauses, the left (primary) mouse button is pressed and held down by default.

    The DRAG clause accepts multiple sets of nRow, nColumn coordinates, allowing the mouse pointer to be dragged to several positions.

    If CLICK or DBLCLICK is included, the mouse is clicked or double-clicked at its current position; then the mouse pointer is dragged to the specified position.

  • PIXELS
    Specifies that the position you include in the AT and DRAG TO clause is in pixels.

    If PIXELS is omitted, the position is determined by the font of the main Visual FoxPro window or the window specified with cWindowName. Most fonts can be displayed in a wide variety of sizes, and some are proportionally spaced. A row corresponds to the height of the current font; a column corresponds to the average width of a letter in the current font.

  • WINDOW cWindowName
    Specifies the window to which the coordinates in the AT and DRAG TO clauses are relative. If you don't include WINDOW and the name of an active window, the coordinates in the AT and DRAG TO clauses are relative to the main Visual FoxPro window.

    To specify a system window or a toolbar, enclose the entire system window or toolbar name in quotation marks.

  • LEFT | MIDDLE | RIGHT
    Specifies which mouse button is pressed when the mouse is clicked, double-clicked, or dragged. If you omit the LEFT, MIDDLE, and RIGHT clauses, the MOUSE commands acts as if you had clicked the left (primary) mouse button.

  • [SHIFT] [CONTROL] [ALT]
    Specifies a key that is pressed when the mouse is clicked, double-clicked, or dragged. In Visual FoxPro for Windows, SHIFT specifies the SHIFT key, CONTROL specifies the CTRL key, and ALT specifies the ALT key.

    You can specify any combination of SHIFT, CONTROL, and ALT.

Remarks

MOUSE is typically used to automate interactive application testing or to create demonstration programs.

Example

In the following example, the first command clicks the mouse at row and column 3 of the main Visual FoxPro window. The second command clicks the mouse at row and column 3 of the main Visual FoxPro window, and then drags the mouse pointer to the tenth row and column of the main Visual FoxPro window. The third command drags the mouse pointer from its current position to row and column 20. The fourth command double-clicks the mouse at its current position, and then drags the mouse pointer to row and column 30. The last command drags the mouse pointer from its current position to row and column 10, then to row and column 20, and then to row and column 30.

MOUSE CLICK AT 3,3
MOUSE CLICK AT 3,3 DRAG TO 10,10
MOUSE DRAG TO 20,20
MOUSE DBLCLICK DRAG TO 30,30
MOUSE DRAG TO 10,10,20,20,30,30

See Also

MCOL( ) | MDOWN( ) | MROW( ) | SYS(1500) - Activate a System Menu Item