DragOver Event

Applies To   See Also

Occurs when a control is being dragged over a target object.

Syntax

PROCEDURE Object.DragOver
LPARAMETERS [nIndex,] oSource, nXCoord, nYCoord, nState

Arguments

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

nIndex

Uniquely identifies a control if it is in a control array.

oSource

Contains a reference to the control being dragged. You can refer to properties and methods of the control with this parameter.

nXCoord, nYCoord

Contains the current horizontal (nXCoord) and vertical (nYCoord) position of the mouse pointer within the target form or control. The coordinates are always expressed in terms of the target's coordinate system in the unit of measurement determined by the ScaleMode property.

nState

Contains a number that represents the transition state of the control being dragged in relation to the target object:

Setting Description
0 Enter. The control is being dragged within the range of a target.
1 Leave. The control is being dragged out of the range of a target.
2 Over. The control has moved from one position in the target to another.

Use nState to determine actions at key transition points. For example, you can highlight a possible target on nState = 0 (Enter) and restore the object's appearance on nState = 1 (Leave).

When an object receives a DragOver event with nState = 0 (Enter):

Remarks

The object under the drag icon is the target object and responds to the DragOver event. You can use this event to monitor when the mouse pointer enters, leaves, or is directly over a target object.

Use a DragOver event to determine what happens after dragging is initiated and before a control is dropped onto a target. For example, you can verify a valid target range by highlighting the target, by setting the BackColor, or ForeColor property or by displaying a special pointer.