SftTree/OCX 7.5 - ActiveX Tree Control


GetData Method, DataObject Object

Retrieves data of a specified format from a DataObject object.


VB.NETData = object.GetData([ ByVal Format As Object ] ) As Object
VBData = object.GetData([ ByVal Format As Variant ] ) As Variant
C#.NETobject Data = object.GetData(object Format);
VC++_variant_t Data = object->GetData(const _variant_t& Format = vtMissing);
CHRESULT object->raw_GetData(VARIANT Format, VARIANT* Data);


A DataObject object.


The data format requested (see SftOLEClipboardConstants). The Format argument is optional. If Format is not specified, GetData returns data in a suitable format.

sftCFText1Text (as a String value)
sftCFBitmap2Bitmap (as Picture object)
sftCFMetafile3Metafile (as Picture object)
sftCFDIB8Device independent bitmap (as Picture object)
sftCFFiles15List of files. The GetData method cannot be used to retrieve this format. Use the DataObject.Files collection instead.
sftCFRTF-16639Rich text format (as String value)


Returns data of a specified format from a DataObject object.


The GetData method retrieves data of a specified format from a DataObject object.

It is possible for the GetData method and DataObject.SetData method to use data formats other than those listed as valid Format argument, including user-defined formats registered with Windows via the RegisterClipboardFormat() API function. The DataObject.SetData method requires the data to be in the form of a byte array when it does not recognize the data format specified. The GetData method always returns data in a byte array when it is in a format that it doesn't recognize, although this may be transparently converted into other data types, such as strings. The byte array returned by GetData will be larger than the actual data when running on some operating systems, with arbitrary bytes at the end of the array. This allocation of memory is often larger than is actually required for the data. Therefore, there may be extraneous bytes near the end of the allocated memory segment.



        Dim insertAt As Integer
        insertAt = AxSftTree1.Items.DropHighlight
        If insertAt < 0 Then Exit Sub
        If e.data.GetFormat(SftOLEClipboardConstants.sftCFText) Then
            Dim lvl As Integer
            lvl = AxSftTree1.get_Item(insertAt).Level
            Dim str As String
            str = e.data.GetData(SftOLEClipboardConstants.sftCFText)
            Dim newItem As Integer
            newItem = AxSftTree1.Items.Insert(insertAt + 1, str)
            AxSftTree1.get_Item(newItem).Level = lvl + 1
        End If
        If e.data.GetFormat(SftOLEClipboardConstants.sftCFDIB) Then
            AxSftTree1.get_Cell(insertAt, 0).Image.Picture = e.data.GetData(SftOLEClipboardConstants.sftCFDIB)
            AxSftTree1.get_Cell(insertAt, 0).ImageHAlign = SftTreeHAlignConstants.halignSftTreeRight
        End If


    horzExtent = SftTree1.Items.HorizontalExtent
    col0Width = SftTree1.Column(0).Width

    insertAt = SftTree1.Items.DropHighlight
    If insertAt < 0 Then Exit Sub

    If Data.GetFormat(vbCFText) Then
        lvl = SftTree1.Item(insertAt).Level
        str = Data.GetData(vbCFText)
        newItem = SftTree1.Items.Insert(insertAt + 1, str)
        SftTree1.Item(newItem).Level = lvl + 1
    ElseIf Data.GetFormat(vbCFDIB) Then
        Set SftTree1.Cell(insertAt, 0).Image.Picture = Data.GetData(vbCFDIB)
        SftTree1.Cell(insertAt, 0).ImageHAlign = halignSftTreeRight
    ElseIf Data.GetFormat(vbCFFiles) Then
        SftTree1.BulkUpdate = True


            if (insertAt < 0) return;
            if (e.data.GetFormat((short) SftOLEClipboardConstants.sftCFText)) {
                short lvl = axSftTree1.get_Item(insertAt).Level;
                string str = (string) e.data.GetData(SftOLEClipboardConstants.sftCFText);
                int newItem = axSftTree1.Items.Insert(insertAt + 1, str);
                axSftTree1.get_Item(newItem).Level = (short) (lvl + 1);
            if (e.data.GetFormat((short) SftOLEClipboardConstants.sftCFDIB)) {
                axSftTree1.get_Cell(insertAt, 0).Image.Picture = (stdole.IPictureDisp)e.data.GetData((short) SftOLEClipboardConstants.sftCFDIB);
                axSftTree1.get_Cell(insertAt, 0).ImageHAlign = SftTreeHAlignConstants.halignSftTreeRight;
            if (e.data.GetFormat((short) SftOLEClipboardConstants.sftCFBitmap)) {
                axSftTree1.get_Cell(insertAt, 0).Image.Picture = (stdole.IPictureDisp)e.data.GetData((short) SftOLEClipboardConstants.sftCFBitmap);
                axSftTree1.get_Cell(insertAt, 0).ImageHAlign = SftTreeHAlignConstants.halignSftTreeRight;
            if (e.data.GetFormat((short) SftOLEClipboardConstants.sftCFFiles)) {


    long horzExtent = m_vTree->Items->HorizontalExtentPix;
    long col0Width = m_vTree->Column[0]->WidthPix;

    long insertAt = m_vTree->Items->DropHighlight;
    if (insertAt < 0) return;

    if (pDataObject->GetFormat(sftCFText) != VARIANT_FALSE) {
        int lvl = m_vTree->Item[insertAt]->Level;
        _variant_t object = pDataObject->GetData((short)sftCFText);
        _bstr_t astring = object;
        long newItem = m_vTree->Items->Insert(insertAt + 1, astring);
        m_vTree->Item[newItem]->Level = lvl + 1;
    } else if (pDataObject->GetFormat(sftCFDIB)) {
        _variant_t object = pDataObject->GetData((short)sftCFDIB);
        IPictureDispPtr pPicDisp = object;

See Also DataObject Object | Object Hierarchy

Last Updated 08/13/2020 - (email)
© 2024 Softel vdm, Inc.