Vcl.Controls.TDragObjectEx

From RAD Studio API Documentation
Jump to: navigation, search

Vcl.Controls.TDragObjectSystem.TObjectTDragObjectEx

Delphi

TDragObjectEx = class(TDragObject)

C++

class PASCALIMPLEMENTATION TDragObjectEx : public TDragObject

Properties

Type Visibility Source Unit Parent
class public
Vcl.Controls.pas
Vcl.Controls.hpp
Vcl.Controls Vcl.Controls

Description

TDragObjectEx is a base class used for managing drag operations.

Use TDragObjectEx as a base class when creating a custom drag object to manage drag-and-drop operations or drag-and-dock operations. Unlike its immediate ancestor, TDragObject, TDragObjectEx and its descendants are automatically freed at the end of a drag operation.

Applications can create the custom drag object in the OnStartDrag event of the dragged control. Use the public IsDragObject function within a target's OnDragOver event when accepting a drag-drop.

In applications that do not need to override the virtual methods of TDragObjectEx, a drag object is created automatically to manage drag operations.

Drag objects allow more flexible drag operation handling. Normally, the Source parameter of the OnDragOver and OnDragDrop events is the control that starts the drag operation. If multiple controls of differing kinds need to start a drag of the same kind of data (for example, a file name, text, or a dollar amount), the source would need support for each kind of control. A drag object allows the target to handle drag sources as a single class of object, because each source control creates the same kind of drag object in their OnStartDrag events. The OnDragOver and OnDragDrop event handlers can tell if the source is a drag object, as opposed to the control, by calling IsDragObject.

Drag objects can be dragged between multiple .DLLs as well as inside the main .EXE. This is useful if you are not using packages but still want drag operations to function from forms implemented in .EXEs to forms implemented in .DLLs.

See Also