event OLEStartDrag (Data as ExDataObject, AllowedEffects as Long)

Occurs when the OLEDrag method is called.

TypeDescription
Data as ExDataObject An ExDataObject object containing formats that the source will provide and, optionally, the data for those formats. If no data is contained in the ExDataObject, it is provided when the control calls the GetData method. The programmer should provide the values for this parameter in this event. The SetData and Clear methods cannot be used here.
AllowedEffects as Long A long containing the effects that the source component supports. The possible values are listed in Settings. The programmer should provide the values for this parameter in this event.
The settings for AllowEffects are:

Syntax for OLEStartDrag event, /NET version, on:

// OLEStartDrag event is not supported. Use the DragEnter,DragLeave,DragOver, DragDrop ... events.

// OLEStartDrag event is not supported. Use the DragEnter,DragLeave,DragOver, DragDrop ... events.

Syntax for OLEStartDrag event, /COM version, on:

private void OLEStartDrag(object sender, AxEXFILEVIEWLib._IExFileViewEvents_OLEStartDragEvent e)
{
}

void OnOLEStartDrag(LPDISPATCH Data,long FAR* AllowedEffects)
{
}

void __fastcall OLEStartDrag(TObject *Sender,Exfileviewlib_tlb::IExDataObject *Data,long * AllowedEffects)
{
}

procedure OLEStartDrag(ASender: TObject; Data : IExDataObject;var AllowedEffects : Integer);
begin
end;

procedure OLEStartDrag(sender: System.Object; e: AxEXFILEVIEWLib._IExFileViewEvents_OLEStartDragEvent);
begin
end;

begin event OLEStartDrag(oleobject Data,long AllowedEffects)
end event OLEStartDrag

Private Sub OLEStartDrag(ByVal sender As System.Object, ByVal e As AxEXFILEVIEWLib._IExFileViewEvents_OLEStartDragEvent) Handles OLEStartDrag
End Sub

Private Sub OLEStartDrag(ByVal Data As EXFILEVIEWLibCtl.IExDataObject,AllowedEffects As Long)
End Sub

Private Sub OLEStartDrag(ByVal Data As Object,AllowedEffects As Long)
End Sub

LPARAMETERS Data,AllowedEffects

PROCEDURE OnOLEStartDrag(oExFileView,Data,AllowedEffects)
RETURN

Syntax for OLEStartDrag event, /COM version (others), on:

<SCRIPT EVENT="OLEStartDrag(Data,AllowedEffects)" LANGUAGE="JScript">
</SCRIPT>

<SCRIPT LANGUAGE="VBScript">
Function OLEStartDrag(Data,AllowedEffects)
End Function
</SCRIPT>

Procedure OnComOLEStartDrag Variant llData Integer llAllowedEffects
	Forward Send OnComOLEStartDrag llData llAllowedEffects
End_Procedure

METHOD OCX_OLEStartDrag(Data,AllowedEffects) CLASS MainDialog
RETURN NIL

// OLEStartDrag event is not supported. Use the DragEnter,DragLeave,DragOver, DragDrop ... events.

function OLEStartDrag as v (Data as OLE::Exontrol.ExFileView.1::IExDataObject,AllowedEffects as N)
end function

function nativeObject_OLEStartDrag(Data,AllowedEffects)
return

The source component should logically Or together the supported values and places the result in the allowedeffects parameter. The target component can use this value to determine the appropriate action (and what the appropriate user feedback should be). You may wish to defer putting data into the ExDataObject object until the target component requests it. This allows the source component to save time.  If the user does not load any formats into the ExDataObject, then the drag/drop operation is canceled. Use the Get property to retrieve the selected items. Use the FullName property to retrieve the full name of the file. You can use the RegisterClipboardFormat API  function to register a new clipboard format. This format can then be used as a valid clipboard format. Use the SingleSel property to allow multiple selection in the control. The control fires the OLEDragDrop event when the user drags data over the control.

The user can drag files from the component only if:

The following VB sample starts dragging the selected files: 

Private Sub ExFileView1_OLEStartDrag(ByVal Data As ExDataObject, AllowedEffects As Long)
    Data.Files.Clear
    With ExFileView1.Get(SelItems)
        Dim i As Long
        For i = 0 To .Count - 1
         Data.Files.Add .Item(i).FullName
        Next
    End With
    If (Data.Files.Count > 0) Then
        AllowedEffects = 1
        Data.SetData , exCFFiles
    End If
End Sub

The following C++ sample starts dragging the selected files: 

#import <exfilevw.dll>
void OnOLEStartDragExfileview1(LPDISPATCH Data, long FAR* AllowedEffects) 
{
	EXFILEVIEWLib::IExDataObjectPtr spData( Data );
	spData->Clear();
	CFiles files = m_fileview.GetGet( 0 /*SelItems*/ );
	for ( long i = 0; i < files.GetCount(); i++ )
		spData->Files->Add( files.GetItem( COleVariant( i ) ).GetFullName().operator LPCTSTR() );
	if ( spData->Files->Count > 0 )
	{
		*AllowedEffects = 1; /*exOLEDropEffectCopy*/
		spData->SetData( vtMissing, COleVariant( long(15) ) ); /*exCFFiles*/
	}
}

The C++ requires #import <exfilevw.dll> to import definitions for ExDataObject and ExDataObjectFiles objects. The #import <exfilevw.dll> generates the EXFILEVIEWLib namespace. If the exfilevw.dll file is located in other directory than system folder, the correct path should be provided, else a compiler error occurs.

The following VB.NET sample starts dragging the selected files:

Private Sub AxExFileView1_OLEStartDrag(ByVal sender As Object, ByVal e As AxEXFILEVIEWLib._IExFileViewEvents_OLEStartDragEvent) Handles AxExFileView1.OLEStartDrag
    e.data.Files.Clear()
    With AxExFileView1.get_Get(EXFILEVIEWLib.TypeEnum.SelItems)
        Dim i As Integer
        For i = 0 To .Count - 1
            e.data.Files.Add(.Item(i).FullName())
        Next
    End With
    If (e.data.Files.Count > 0) Then
        e.allowedEffects = 1
        e.data.SetData(, EXFILEVIEWLib.exClipboardFormatEnum.exCFFiles)
    End If
End Sub

The following C# sample starts dragging the selected files:

private void axExFileView1_OLEStartDrag(object sender, AxEXFILEVIEWLib._IExFileViewEvents_OLEStartDragEvent e)
{
	e.data.Files.Clear();
	EXFILEVIEWLib.Files files = axExFileView1.get_Get(EXFILEVIEWLib.TypeEnum.SelItems);
	for ( int i = 0 ; i < files.Count; i++ )
		e.data.Files.Add(files[i].FullName);
	if (e.data.Files.Count > 0)
	{
		e.allowedEffects = 1;
		e.data.SetData(null, EXFILEVIEWLib.exClipboardFormatEnum.exCFFiles);
	}
}

The following VFP sample starts dragging the selected files:

*** ActiveX Control Event ***
LPARAMETERS data, allowedeffects

Data.Files.Clear
With thisform.ExFileView1.Get(0) && SelItems
    local i
    For i = 0 To .Count - 1
     data.Files.Add(.Item(i).FullName)
    Next
EndWith
If (Data.Files.Count > 0) Then
    AllowedEffects = 1
    data.SetData( , 15) && exCFFiles
EndIf