DragDrop Event

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

PROCEDURE Object.DragDrop
LPARAMETERS oSource, 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 DragDrop event parameters in the following order:

  • oSource
    References the control being dragged. You can refer to properties and methods of the control with this parameter.
  • nXCoord, nYCoord
    Contains the horizontal (nXCoord) and vertical (nYCoord) position of the mouse pointer within the Form when data is dropped on a drop target. These coordinates are expressed in terms of the Form's coordinate system in the unit of measurement specified by the ScaleMode property of the Form.

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.

See Also

Drag Method | DragIcon Property | DragMode Property | DragOver Event | MouseDown Event | MouseUp Event | MouseMove Event

Applies To: CheckBox | ComboBox | CommandButton | CommandGroup | Container Object | Control Object | EditBox | Form | Grid | Image | Label | Line | ListBox | OLE Bound Control | OLE Container Control | OptionButton | OptionGroup | Page | PageFrame | Shape | Spinner | TextBox | ToolBar