[Overview][Constants][Types][Classes][Procedures and functions][Variables][Index] | Reference for unit 'Controls' (#lcl)

# TControl.DoDragMsg

Handler for a drag message, sent by the DragManager to the current target control.

## Declaration

Source position: controls.pp line 1468

`protected function TControl.DoDragMsg(`
`ADragMessage: TDragMessage;`
`APosition: TPoint;`
`ADragObject: TDragObject;`
`ATarget: TControl;`
`ADocking: Boolean`
`):LRESULT; virtual;`

## Arguments

`ADragMessage` |  | The task to perform.
`APosition` |  | The mouse position in screen coordinates.
`ADragObject` |  | The drag object.
`ATarget` |  | The drop target, Nil if none.
`ADocking` |  | Distinguishes between a drag-drop and drag-dock operation.

## Function result

The Result member is polymorphic:

For dmFindTarget, the result is a reference to the target control. For dmDragDropm the result is zero (0). For other drag messages, the result indicates acceptance of the drop message.

## Description

These messages can be sent while dragging:

dmFindTarget
  Request to determine the possible target control for an drop. A TControl returns itself, a TWinControl finds the child control closest to the mouse position.
dmDragEnter, dmDragLeave, dmDragMove
  Notification of mouse moves. Invokes DragOver, or DockOver if docking. Result indicates acceptance of a drop.
dmDragDrop
  The dragged object has been dropped onto this control. Invokes DragDrop, or DockDrop if docking.

The Source argument of the invoked methods is the DragDockObject when docking. If the DragObject has been AutoCreated, the dragged control is passed as the Source. Otherwise, the DragObject itself is passed as Source.