ClearData, GetData, SetData
These are all methods of the DataObject, a COM object that provides access to data being dragged with OLE drag and drop. ClearData removes all data from the data object. GetData retrieves data, and SetData puts data into the data object.
Usage |
oDataObject.ClearData() uResult = oDataObject.GetData( [ nFormat | cFormat ] [, @aHoldData ] ) oDataObject.SetData( uData | @aData [, nFormat | cFormat ] ) |
Parameter |
Value |
Meaning |
nFormat |
1, 7 or 13 |
Retrieve or place textual data in ASCII, OEM or Unicode format, respectively. As far as we can tell, in the U.S. Windows version of VFP, no native controls automatically supply either OEM or Unicode format data, though other applications might, and you can provide data in one of those formats. |
15 |
Retrieve or place a list of files. |
|
16 |
Documented (for SetData only) as providing a handle to the locale identifier for text on the clipboard, but we haven't been able to retrieve any data in this format. |
|
Any other number |
Retrieve or place data in a custom format. |
|
Omitted |
If cFormat is also omitted, place scalar data in the data object in the text (1) and "OLE Variant" formats, or place array data in the "OLE Variant Array" format. |
|
cFormat |
"OLE Variant Array" |
Retrieve or place multiple data items in their original format. Use this one to drag a whole array of data. |
"OLE Variant" |
Retrieve or place data in its original type. For example, data from a spinner is treated as numeric, using this format. |
|
"VFP Source Object" |
Retrieve a reference to the data source for this drag. By default, all VFP controls make this format available. Data cannot be placed in the data object in this format. |
|
Any other string |
Retrieve or place data in a custom format. |
|
Omitted |
If nFormat is also omitted, place scalar data in the data object in the text (1) and "OLE Variant" formats or place array data in the "OLE Variant Array" format. |
|
aHoldData |
Array name |
The name of an array holding the data retrieved from the data object. Relevant only for some data formats. |
uResult |
.T. |
Data in one of the array formats was successfully retrieved. |
.F. |
The data object doesn't contain any data in the specified format. |
|
Other |
The data retrieved from the data object. |
|
uData |
Expression |
The data to be placed in the data object for one of the single-valued formats. |
aData |
Array name |
The name of the array holding the data to be placed in the data object. Relevant only for the multi-valued formats. |
Example |
* If the data being dragged is a list of files, put * the contents of the first file into the receiving * edit box's Value. This code would go in the edit box's * DragDrop method. LPARAMETERS oDataObject, nEffect, nButton, nShift, ; nXCoord, nYCoord #INCLUDE FOXPRO.H LOCAL lHasFiles, FileArray[1] IF oDataObject.GetFormat(CF_FILES) lHasFiles = oDataObject.GetData(CF_FILES, @FileArray) This.Value = FileToStr(FileArray[1]) ENDIF |
See Also |
CreateBinary(), DataObject, GetFormat, OLE drag and drop, OLEDragDrop, OLESetData, OLEStartDrag, SetFormat |