[Overview][Constants][Types][Classes][Procedures and functions][Variables][Index] |
[Properties (by Name)] [Methods (by Name)] [Events (by Name)]
Base class for managing drag operations and user feedback.
Source position: controls.pp line 400
type TDragObject = class end; |
||
protected |
||
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). |
public |
||
constructor Create(); virtual; |
|
Remembers the dragged control. |
constructor AutoCreate(); |
|
Special constructor, enforcing the 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. |
|
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. |
|
| | ||
TObject |
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, so that you must not take special care on it. But an application can provide a customized DragObject in the TControl.OnStartDrag or TControl.OnStartDock handlers of the source control (being dragged).
Remark: | AutoCreated DragObjects imply different behaviour in the DragOver and DragDrop events, where the Source becomes the dragged control, while else the DragObject itself is passed as Source. |
TDragObject is the ancestor of an whole tree of dragging objects, with the main branches supporting either drag-drop or drag-dock operations. The type of the operation is determined from the TControl.DragKind property of the source control.
Remark: | In contrast to the Delphi implementation, Lazarus has moved a couple of methods into the drag performers, so that these are no more available for customization. |
A Lazarus 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.
[entire review DoDi 2011-09-10]
|
A drag object for dragging a control. |
|
|
A drag object for drag-dock. |
lazarus-ccr.sourceforge.net |