From RAD Studio API Documentation
Jump to: navigation, search


property OnStartDrag: TStartDragEvent read FOnStartDrag write FOnStartDrag;


__property TStartDragEvent OnStartDrag = {read=FOnStartDrag, write=FOnStartDrag};


Type Visibility Source Unit Parent
event protected
Vcl.Controls TControl


Occurs when the user begins to drag the control or an object it contains by left-clicking the control and holding the mouse button down.

Use the OnStartDrag event handler to implement special processing when the user starts to drag the control or an object it contains. OnStartDrag only occurs if DragKind is dkDrag.

Sender is the control that is about to be dragged, or that contains the object about to be dragged.

The OnStartDrag event handler can create a TDragControlObjectEx instance for the DragObject parameter to specify the drag cursor, or, optionally, a drag image list. If you create a TDragControlObjectEx instance, there is no need to call the Free method for the DragObject when dragging is over. If you create, instead, a TDragControlObject instance, your application is responsible for freeing the drag object instance.

If the OnStartDrag event handler sets the DragObject parameter to nil (Delphi) or NULL (C++), a TDragControlObject object is automatically created and dragging begins on the control itself.

Note: On some controls, such as TRichEdit, the underlying Windows control handles internal drag operations. For these controls, there are no OnStartDrag or OnEndDrag events for drag operations within the control.

OnStartDrag is an event handler of type TStartDragEvent.

See Also