AMOUSEOBJ( ) Function

Creates an array containing information about the mouse pointer position and the object over which the mouse pointer is positioned.

AMOUSEOBJ(ArrayName [, 1])

Parameters

  • ArrayName
    Specifies the name of the array containing the mouse pointer information. If the array you specify doesn't exist, Visual FoxPro automatically creates a four-row array. If the array exists, Visual FoxPro dimensions it to four rows.

    The following table describes the contents of each row in the array:

    Array row

    Description

    1

    Contains an object reference to the object over which the mouse pointer is positioned when AMOUSEOBJ( ) is executed.

    2

    Contains an object reference to the container of the object over which the mouse pointer is positioned when AMOUSEOBJ( ) is executed.

    3

    Contains the horizontal (X) coordinate in pixels of the mouse pointer, relative to the container of the object over which the mouse pointer is positioned when AMOUSEOBJ( ) is executed.

    4

    Contains the vertical (Y) coordinate in pixels of the mouse pointer, relative to the container of the object over which the mouse pointer is positioned when AMOUSEOBJ( ) is executed.

Note

The first and second rows in the array can contain the same values if the mouse is positioned over a generic container such as a pageframe.

  • [, 1]
    This optional parameter specifies that the mouse pointer information contained in the array is relative to the current form (THISFORM). If you include this option, the second array row always contains an object reference to the current form, and the third and fourth rows contain the mouse pointer coordinates relative to the current form.

Return Value

Numeric

Remarks

You can also use AMOUSEOBJ( ) to determine where to position the mouse pointer during design time. The following table lists the design time element and the values contained in each row of the array:

Design-time element

Array contents

Form and Class Designers

Row 1 – Object reference to the control.Row 2 – Object reference to the form.Row 3 – Mouse pointer horizontal (X) coordinate relative to the form.Row 4 – Mouse pointer vertical (Y) coordinate relative to the form.

Project Manager

Row 1 – Object reference to the project.Row 2 – Object reference to the project.Row 3 – Zero.Row 4 – Zero.

Visual FoxPro Desktop

Row 1 – Object reference to the desktop.Row 2 – Object reference to the desktop.Row 3 – Mouse pointer horizontal (X) coordinate relative to the desktop.Row 4 – Mouse pointer vertical (Y) coordinate relative to the desktop.

AMOUSEOBJ( ) returns 4 (the number of rows in the array) if you position the mouse pointer over an area listed above. If you position the mouse pointer over an area other than those listed above, AMOUSEOBJ( ) returns zero. If the array you specify already exists, it remains unchanged. If the array you specify does not exist, the system does not create it.

See Also

Reference

MCOL( ) Function

MROW( ) Function

SYS(1270) - Object Location

ASELOBJ( ) Function

Other Resources

Functions

Language Reference (Visual FoxPro)