Unit 'Controls' Package
[Overview][Constants][Types][Classes][Procedures and functions][Variables][Index] [#lcl]


[Properties (by Name)] [Methods (by Name)] [Events (by Name)]

Base class for managing drag operations and user feedback.


Source position: controls.pp line 446

type TDragObject = class


  procedure EndDrag(); virtual;


Called when a dragging operation ends.

  function GetDragImages; virtual;


Returns a list of images for dragging.

  function GetDragCursor(); virtual;


Returns the dragging cursor type (shape).


  constructor Create(); virtual;


Constructor for the class instance.

  constructor AutoCreate();


Special constructor which enforces destruction of the object at the end of the dragging operation.

  procedure HideDragImage; virtual;


Asks the image list to hide the drag image.

  procedure ShowDragImage; virtual;


Asks the image list to show the drag image.

  property AlwaysShowDragImages: Boolean; [rw]


Should the image of dragged objects always be shown?

  property AutoCreated: Boolean; [r]


Was the drag object created automatically?

  property AutoFree: Boolean; [r]


Indicates whether the object shall be destroyed at the end of the dragging operation.

  property Control: TControl; [rw]


The control that is dragged (source).

  property DragPos: TPoint; [rw]


Current mouse position in screen coordinates.

  property DragTarget: TControl; [rw]


The control over which the object currently is dragged (target).

  property DragTargetPos: TPoint; [rw]


Mouse position in client coordinates of the DragTarget.

  property Dropped: Boolean; [r]


Indicates whether the drag object has been dropped yet.





Base class for managing drag operations and user feedback.




Every dragging operation has an associated DragObject, holding references to the source and target controls, and other parameters for the customization of the visual user feedback.

A default DragObject is created automatically when a dragging operation starts, and is destroyed when the operation has ended; you do not need to maintain it. But an application can provide a customized DragObject in the TControl.OnStartDrag or TControl.OnStartDock handlers for the source control (the one being dragged).

Remark: AutoCreated DragObjects imply different behavior in the DragOver and DragDrop events, where the Source becomes the dragged control, while the DragObject itself is passed as Source.

TDragObject is the ancestor of a whole tree of dragging objects, with the main branches supporting either drag-drop or drag-dock operations. The type of the operation is determined using the TControl.DragKind property in the source control.

Remark: In contrast to the Delphi implementation, Typhon has moved a couple of methods into the drag performers; these methods are no longer available for customization.

A Typhon DragObject mainly supplies the cursor and images, used in visual user feedback. Drag-drop operations typically signal acceptance of an possible drop by variations of the mouse cursor, and optionally can attach to it shapes of the dragged object(s). Drag-dock operations instead show a docking rectangle, that snaps to possible target locations when the mouse moves over docksites.

See also



A drag object for dragging a control.



A drag object for drag-dock.

CT Web help

CodeTyphon Studio