次の方法で共有


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])

Return Values

Numeric

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 the array. If the array exists and isn't large enough to contain all the lines in the memo field, Visual FoxPro automatically increases the size of the array. If the array is larger than necessary, Visual FoxPro truncates the array.

    The array that is created contains 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 that 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 this option is included, 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.

Remarks

AMOUSEOBJ( ) can also be used to determine where the mouse pointer is positioned 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 the mouse pointer is positioned over an area listed above. If the mouse pointer is positioned over an area other than those listed above, AMOUSEOBJ( ) returns zero and if the array you specify already exists, it remains unchanged. If the array you specify doesn't exist, it isn't created.

See Also

MCOL( ) | MROW( ) | SYS(1270) - Object Location | ASELOBJ( ) Function