MouseWheel Event

Applies To   See Also

Occurs when the user rotates the mouse wheel on a mouse device that has a wheel.

Syntax

PROCEDURE Object.MouseWheel
LPARAMETERS [nIndex,] nDirection, nShift, nXCoord, nYCoord

Parameters

You must include an LPARAMETERS or PARAMETERS statement in the event procedure and specify a name for each parameter. Visual FoxPro passes the MouseWheel event four or five parameters in the following order.

nIndex

Contains a number which uniquely identifies a control if it is in a control array. The nIndex parameter is passed only when the control is in a control array.

nDirection

Contains a mouse device dependent number that indicates the direction the mouse wheel is rotated. A negative value indicates the mouse wheel is rotated backwards; a positive value indicates the mouse wheel is rotated forwards.

nShift

Contains a number specifying the state of modifier keys when the mouse wheel is rotated. The valid modifier keys are the SHIFT, CTRL, and ALT keys.

The values returned in nShift for individual modifier keys are listed in the following table.

Value Key
1 SHIFT
2 CTRL
4 ALT

If more than one modifier key is held down when the mouse wheel is rotated, the nShift argument contains the sum of the values for the modifier keys. For example, if the user holds CTRL while rotating the mouse wheel, the nShift argument contains 2. But if the user holds CTRL+ALT while rotating the mouse wheel, the nShift argument contains 6.

nXCoord, nYCoord

Contains the current horizontal (nXCoord) and vertical (nYCoord) position of the mouse pointer within the form. These coordinates are always expressed in terms of the form's coordinate system, in the unit of measurement specified in the ScaleMode property setting.