Skip to main content

TcxCustomGridView.OnStartDrag Event

Occurs when a user starts dragging by left-clicking the current View.

Declaration

property OnStartDrag: TStartDragEvent read; write;

Remarks

Handle the OnStartDrag event to perform special processing when a user starts dragging within the current View.

The Sender parameter specifies the grid site (TcxGridSite) object referring to the current View. A grid site is a control which owns Views and processes mouse and keyboard events. To access the View displayed by a site object, see the TcxGridSite.GridView property.

During drag-and-drop, a drag object is created. It refers to the control within which the operation was started. The drag object is passed as the Source parameter to the OnDragOver and OnDragDrop event handlers of the target control.

By default, the drag object represents an instance of the TcxDragControlObject class. If drag-and-drop starts within a grid View, the Control property of the drag object refers to the grid site owning the View. If drag-and-drop starts within root level tabs of a grid, the Control property refers to the grid control itself.

The OnStartDrag event allows you to use a custom drag object. You can implement your own type of drag object by deriving from TDragObject or its descendants (TDragControlObjectEx, TDragControlObject). The drag object can provide the target control with more information on the source control. A custom drag object can also be implemented to provide a specific drag cursor or drag image list to display while dragging. In the OnStartDrag event handler, create an instance of your drag object and assign it to the DragObject parameter.

The initial value of DragObject is NIL. If the OnStartDrag event handler sets DragObject to NIL, a TcxDragControlObject object is automatically created and subsequently available to the source control.

See Also