MCOL( ) Function

Returns the column position of the mouse pointer in the main Visual FoxPro window or a user-defined window or form.

MCOL([cWindowName | 0 [, nScaleMode]])

Parameters

  • cWindowName
    Specifies the name of the window or form whose mouse-pointer column position MCOL( ) returns.

  • 0
    Specifies that the column position of the mouse pointer is returned for the currently active window or form.

  • nScaleMode
    Specifies the unit of measurement for the value MCOL( ) returns. The following table lists the settings for nScaleMode.

    nScaleMode

    Description

    0

    Foxels. A foxel is equivalent to the average height and width of a character based on the current font of the form in which an object is contained. (Default)

    3

    Pixels. A pixel is the smallest element that can be displayed on a screen or printer. Pixels are screen-dependent.

Return Value

Numeric. MCOL( ) returns the column position of the mouse pointer in the main Visual FoxPro window, user-defined window, or form.

If you omit cWindowName, and there is no active user-defined window or form, MCOL( ) returns the mouse pointer's column position in the main Visual FoxPro window. If you omit cWindowName, and there is an active user-defined window or form, MCOL( ) returns the mouse pointer's column position in the active user-defined window or form. MCOL( ) returns –1 if the mouse pointer is positioned outside the user-defined window or form, if no mouse driver is loaded, or there is no output window.

Remarks

Using the MCOL( ) function without the optional argument 0 may affect the behavior of code on forms when the Form AllowOutput property IS set to false (.F.). For example, the placement of a shortcut menu that is defined in the RightClick event may not display in the proper location if you use the MCOL( ) and MROW( ) functions to determine where the menu is displayed. In this case, be sure to include 0 in the MCOL( ) and MROW( ) functions.

See Also

Reference

AMOUSEOBJ( ) Function

COL( ) Function

GridHitTest Method

INKEY( ) Function

ISMOUSE( ) Function

MROW( ) Function

ROW( ) Function

WCOLS( ) Function

WROWS( ) Function

Other Resources

Functions