Hide

SftDirectory 3.5 - ActiveX File/Folder Control

Display
Print

DataObject.Clear Method

Clears all data and formats in a DataObject object.

Syntax

VB.NETobject.Clear()
VBobject.Clear
C#.NETvoid object.Clear();
VC++HRESULT object->Clear();
CHRESULT object->raw_Clear();

object

A DataObject object.

Comments

The Clear method clears all data and formats in a DataObject object.

This method is available only for OLE drag sources. If Clear is called from a drop target component, an error is generated.

Examples

VB.NET

    Dim F As SftDirectoryFolder
    F = AxSftDirectory1.CurrentFolder
    If Not F Is Nothing Then
        AxSftDirectory1.OLEDrag(False, True, -1, -1)
    End If
End Sub

Private Sub AxSftDirectory1_OLEStartDrag(ByVal sender As Object, ByVal e As AxSftDirectoryLib30._ISftDirectoryEvents_OLEStartDragEvent) Handles AxSftDirectory1.OLEStartDrag
    e.data.Clear()
    e.data.SetData(Nothing, SftOLEClipboardConstants.sftCFText)
    e.allowedEffects = 1 'vbDropEffectCopy
End Sub

Private Sub AxSftDirectory1_OLESetData(ByVal sender As Object, ByVal e As AxSftDirectoryLib30._ISftDirectoryEvents_OLESetDataEvent) Handles AxSftDirectory1.OLESetData
    If e.format = SftOLEClipboardConstants.sftCFText Then
        e.data.SetData("We're dragging a text string - """ & AxSftDirectory1.CurrentFolder.Name & """ - drop it in Write, Word (for example)", SftOLEClipboardConstants.sftCFText)

VB6

    Set F = SftDirectory1.CurrentFolder
    If Not F Is Nothing Then
        SftDirectory1.OLEDrag False, True, -1, -1
    End If
End Sub

Private Sub SftDirectory1_OLEStartDrag(Data As SftDirectoryLib30.DataObject, _
        AllowedEffects As Long)
    Data.Clear
    Data.SetData , sftCFText
    AllowedEffects = vbDropEffectCopy
End Sub

Private Sub SftDirectory1_OLESetData(Data As SftDirectoryLib30.DataObject, Format As Integer)
    If Format = sftCFText Then
        Data.SetData "We're dragging a text string - """ & SftDirectory1.CurrentFolder.Name & """ - drop it in Write, Word (for example)", sftCFText

C#

    f = axSftDirectory1.CurrentFolder;
    if (f != null) {
        axSftDirectory1.OLEDrag(false, true, -1, -1);
    }
}

private void axSftDirectory1_OLEStartDrag(object sender, AxSftDirectoryLib30._ISftDirectoryEvents_OLEStartDragEvent e)
{
    e.data.Clear();
    e.data.SetData(null, SftOLEClipboardConstants.sftCFText);
    e.allowedEffects = 1; //vbDropEffectCopy
}

private void axSftDirectory1_OLESetData(object sender, AxSftDirectoryLib30._ISftDirectoryEvents_OLESetDataEvent e)
{
    if (e.format == (short) SftOLEClipboardConstants.sftCFText) {

C++

    if (pFolder)
        m_vDir1->OLEDrag(VARIANT_FALSE, VARIANT_TRUE, -1, -1);
}

void COLEDragDlg::OnOLEStartDragSftDirectory1(LPDISPATCH FAR* Data, long FAR* AllowedEffects)
{
    IVDMDataObjectPtr pData(*Data);

    pData->Clear();
    pData->SetData(_variant_t(), _variant_t((short) sftCFText));
    *AllowedEffects = 1; //vbDropEffectCopy
}

void COLEDragDlg::OnOLESetDataSftDirectory1(LPDISPATCH FAR* Data, short FAR* Format)
{
    IVDMDataObjectPtr pData(*Data);

See Also DataObject Object | Object Hierarchy


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