DragDrop Event

Applies To   See Also

Occurs when a drag-and-drop operation is completed.

Syntax

PROCEDURE Object.DragDrop
LPARAMETERS [nIndex,] oSource, nXCoord, nYCoord

Arguments

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

nIndex

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

oSource

References 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) coordinates of the mouse pointer within the target form or control. These coordinates are always expressed in terms of the target's coordinate system in the unit of measurement determined by the ScaleMode property.

Remarks

A drag-and-drop operation is completed when a control is dragged over another control or form and the mouse button is released, or when the Drag method with its nAction argument set to 2 (Drop) is called for the control.

Use a DragDrop event to control what happens after a drag operation is complete. For example, you can move the source control to a new location or copy a file from one location to another.

Note   The DragDrop event involves two objects, a control being dragged and a target object. The DragDrop event is triggered for the target object, not the control being dragged.

Use the DragMode property and Drag method to specify how dragging is to be initiated. Once dragging is initiated, you can handle events that precede a DragDrop event with a DragOver event.