DragSetData (Magic xpa 2.x)

« Go Back


Created ByKnowledge Migration User
Approval Process StatusPublished

DragSetData (Magic xpa 2.x)

Determines the data content and format for a control that is not defined for automatic data handling. This function also lets you assign the data content to a different data format.


DragSetData (data content, data format, user defined format)


data content – A string value that represents the actual data to set. This data is stored in a Windows buffer, which is accessible by whatever Windows application receives the dropped data.

data format – A numeric value that represents the format of the data stored by the operating system. The following numeric values are:

0 – User-defined format

1 – Text

2 – OEM Text

3 – Rich Text

4 – HTML

5 – Hyperlink

6 – File name and path

7 – Unicode

user-defined format – An optional string parameter that names a user-defined format. This parameter is required when the data format parameter is set to 0 but is not relevant for other data formats.


True only when evaluated within the scope of an active Drag Begin event.


DragSetData ('ABC', 1) results in displaying the 'ABC' string as the actual Text format drag operation data and defines the text format as the default.


The DragSetData function can be performed several times to define data for different types of formats. Each data format can only be set once with data in a single drag operation. If the function is evaluated twice for the same data format within the same drag operation, only the last evaluation will be applied.

Platform specific:

This function is not supported for mobile devices.

See also:

How Do I Allow Drag and Drop Only Within Magic xpa so that External Applications Cannot Retrieve the Data?

The Online and Rich Client Samples projects (program HG05 and RHG05)