Hide

SftDirectory 3.5 - ActiveX File/Folder Control

Display
Print

SftDirectory.OLESetData Event

Source object can provide data and/or data formats.

Syntax

VB.NETPrivate Sub object_OLESetData(ByVal sender As Object, ByVal e As EventArgumentType) Handles object.OLESetData
VBPrivate Sub object_OLESetData(Data As DataObject, Format As Integer)
C#.NETvoid object_OLESetData(object sender, EventArgumentType e);
VC++void OnOLESetDataobject(struct IVDMDataObject** Data, short* Format);
CHRESULT OnOLESetDataobject(struct IVDMDataObject** Data, short* Format);

object

A SftDirectory object.

Data

A DataObject object containing formats that the source will provide and, in addition, possibly the data for those formats. If no data is contained in the DataObject, it is provided when the control calls the GetData method and you should provide the values for the Data parameter.

Format

The format of the data that the target component is requesting. The source component uses this value to determine what to load into the DataObject object.

Comments

The OLESetData event occurs when source object can provide data and/or data formats.

In certain cases, you may wish to defer loading data into the DataObject object of a source component to save time, especially if the source component supports many formats. This event allows the source to respond to only one request for a given format of data. When this event is called, the source should check the Format parameter to determine what needs to be loaded and then perform the SetData method on the DataObject object to load the data which is then passed back to the target component.

Examples

VB.NET

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)
    End If
End Sub

VB6

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
    End If
End Sub

C#

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) {
        e.data.SetData("We're dragging a text string - \"" + axSftDirectory1.CurrentFolder.Name + "\" - drop it in Write, Word (for example)", SftOLEClipboardConstants.sftCFText);
    }
}

C++

{
    return (HCURSOR) m_hIcon;
}

BEGIN_EVENTSINK_MAP(COLEDragDlg, CDialog)
    //{{AFX_EVENTSINK_MAP(COLEDragDlg)
    ON_EVENT(COLEDragDlg, IDC_SFTDIRECTORY1, 4 /* DragStarting */, OnDragStartingSftDirectory1, VTS_I2 VTS_I2 VTS_I4 VTS_I4)
    ON_EVENT(COLEDragDlg, IDC_SFTDIRECTORY1, 35 /* OLEStartDrag */, OnOLEStartDragSftDirectory1, VTS_PDISPATCH VTS_PI4)
    ON_EVENT(COLEDragDlg, IDC_SFTDIRECTORY1, 34 /* OLESetData */, OnOLESetDataSftDirectory1, VTS_PDISPATCH VTS_PI2)
    //}}AFX_EVENTSINK_MAP
END_EVENTSINK_MAP()

BOOL COLEDragDlg::OnInitDialog()
{
    CDialog::OnInitDialog();

See Also SftDirectory Object | Object Hierarchy


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