Skip to content

BeginDrag Event

Description

Occurs when records start to be dragged from within the Grid Control.

Syntax

Public Event BeginDrag( _
    ByVal Records As GridRecords _
)

Parameters

  • Records
    GridRecords collection containing all of the records that will be dragged. This gives the opportunity to modify the GridRecords collection before they are actually added to the clipboard.

Remarks

The BeginDrag event occurs when records are being dragged from the Grid Control and provides a GridRecords collection containing all of the selected records when the drag operation started. This gives the opportunity to modify the GridRecords collection before they are actually added to the clipboard.

Notes

The DropRecords event occurs when records are dropped into a Grid Control and provides a GridRecords collection containing all of the records that will be dropped into the Grid Control. This gives the opportunity to modify the GridRecords collection before they are actually added to the Grid Control.


The CreateRecords method is primarily used to create an empty GridRecords collection in Drag and Drop operations. The new GridRecords collection is used to create a collection of GridRecord objects to be dropped into the Grid Control or to retrieve records that have been dragged out of the Grid Control.

The CreateRecordsFromDropArray method is used when retrieving records that have been dragged from the Grid Control. CreateRecordsFromDropArray accepts the ByteArray returned from the Data.GetData parameter from any control's OLEDragDrop event and populates a GridRecords collection created by CreateRecords with the records stored on the clipboard.

The DragRecords method is used to prepare records to be dropped into the Grid Control. DragRecords accepts a GridRecords collection created by CreateRecords. Any records that have been prepared using DragRecords will be added to the Grid when the items are dropped into the Grid Control. Typically, DragRecords would be used in the MouseMove event of the control from which items are being dragged. The Grid Control will automatically add the new records to the grid once they have been dropped.

To enable Drag and Drop in a Grid Control, the EnableDragDrop method must be used. EnableDragDrop does two things: first, it sets a clipboard string that will be used to indicate the type of data that is copied to the clipboard. Second, it sets the drag and drop effects that are allowed when dragging items to/from the Grid Control. The available effects are stored in the XTPGridDragDrop enumeration. If dragging items to/from one or more Grid Controls, the same clipboard string must be used for all Grid Controls when calling EnableDragDrop.

See Also

Example

Drag and Drop Sample


Copyright (c) 1998-2024 Codejock Technologies. All rights reserved.