Occurs when a source component is dropped onto a target component when the source component determines that a drop can occur.
Type | Description | |||
Data as ExDataObject | An ExDataObject object containing formats that the source will provide and, in addition, possibly the data for those formats. If no data is contained in the ExDataObject, it is provided when the control calls the GetData method. The SetData and Clear methods cannot be used here. | |||
Effect as Long | A Long set by the target component identifying the action that has been performed (if any), thus allowing the source to take appropriate action if the component was moved (such as the source deleting the data). The possible values are listed in Remarks. | |||
Button as Integer | An integer which acts as a bit field corresponding to the state of a mouse button when it is depressed. The left button is bit 0, the right button is bit 1, and the middle button is bit 2. These bits correspond to the values 1, 2, and 4, respectively. It indicates the state of the mouse buttons; some, all, or none of these three bits can be set, indicating that some, all, or none of the buttons are depressed. | |||
Shift as Integer | An integer which acts as a bit field corresponding to the state of the SHIFT, CTRL, and ALT keys when they are depressed. The SHIFT key is bit 0, the CTRL key is bit 1, and the ALT key is bit 2. These bits correspond to the values 1, 2, and 4, respectively. The shift parameter indicates the state of these keys; some, all, or none of the bits can be set, indicating that some, all, or none of the keys are depressed. For example, if both the CTRL and ALT keys were depressed, the value of shift would be 6. | |||
X as OLE_XPOS_PIXELS | A single that specifies the current X location of the mouse pointer. The X value is always expressed in container coordinates. | |||
Y as OLE_YPOS_PIXELS | A single that specifies the current Y location of the mouse pointer. The Y value is always expressed in container coordinates. |
The OLEDragDrop event is fired when the user has dropped files or clipboard information into ExFileView control. Use the OLEDropMode property on exOLEDropManual to enable OLE drag drop support. Use the FileFromPoint property to retrieve the file from the cursor.
The settings for Effect are:
// OLEDragDrop event is not supported. Use the DragEnter,DragLeave,DragOver, DragDrop ... events. // OLEDragDrop event is not supported. Use the DragEnter,DragLeave,DragOver, DragDrop ... events. |
private void OLEDragDrop(object sender, AxEXFILEVIEWLib._IExFileViewEvents_OLEDragDropEvent e) { } void OnOLEDragDrop(LPDISPATCH Data,long FAR* Effect,short Button,short Shift,long X,long Y) { } void __fastcall OLEDragDrop(TObject *Sender,Exfileviewlib_tlb::IExDataObject *Data,long * Effect,short Button,short Shift,int X,int Y) { } procedure OLEDragDrop(ASender: TObject; Data : IExDataObject;var Effect : Integer;Button : Smallint;Shift : Smallint;X : Integer;Y : Integer); begin end; procedure OLEDragDrop(sender: System.Object; e: AxEXFILEVIEWLib._IExFileViewEvents_OLEDragDropEvent); begin end; begin event OLEDragDrop(oleobject Data,long Effect,integer Button,integer Shift,long X,long Y) end event OLEDragDrop Private Sub OLEDragDrop(ByVal sender As System.Object, ByVal e As AxEXFILEVIEWLib._IExFileViewEvents_OLEDragDropEvent) Handles OLEDragDrop End Sub Private Sub OLEDragDrop(ByVal Data As EXFILEVIEWLibCtl.IExDataObject,Effect As Long,ByVal Button As Integer,ByVal Shift As Integer,ByVal X As Single,ByVal Y As Single) End Sub Private Sub OLEDragDrop(ByVal Data As Object,Effect As Long,ByVal Button As Integer,ByVal Shift As Integer,ByVal X As Long,ByVal Y As Long) End Sub LPARAMETERS Data,Effect,Button,Shift,X,Y PROCEDURE OnOLEDragDrop(oExFileView,Data,Effect,Button,Shift,X,Y) RETURN |
<SCRIPT EVENT="OLEDragDrop(Data,Effect,Button,Shift,X,Y)" LANGUAGE="JScript"> </SCRIPT> <SCRIPT LANGUAGE="VBScript"> Function OLEDragDrop(Data,Effect,Button,Shift,X,Y) End Function </SCRIPT> Procedure OnComOLEDragDrop Variant llData Integer llEffect Short llButton Short llShift OLE_XPOS_PIXELS llX OLE_YPOS_PIXELS llY Forward Send OnComOLEDragDrop llData llEffect llButton llShift llX llY End_Procedure METHOD OCX_OLEDragDrop(Data,Effect,Button,Shift,X,Y) CLASS MainDialog RETURN NIL // OLEDragDrop event is not supported. Use the DragEnter,DragLeave,DragOver, DragDrop ... events. function OLEDragDrop as v (Data as OLE::Exontrol.ExFileView.1::IExDataObject,Effect as N,Button as N,Shift as N,X as OLE::Exontrol.ExFileView.1::OLE_XPOS_PIXELS,Y as OLE::Exontrol.ExFileView.1::OLE_YPOS_PIXELS) end function function nativeObject_OLEDragDrop(Data,Effect,Button,Shift,X,Y) return |
The following VB sample displays the list of files being dragged to the control ( open your Windows Explorer, select some files and drag them to the control ) :
Private Sub ExFileView1_OLEDragDrop(ByVal Data As EXFILEVIEWLibCtl.IExDataObject, Effect As Long, ByVal Button As Integer, ByVal Shift As Integer, ByVal X As Single, ByVal Y As Single) With Data.Files Dim i As Long For i = 0 To .Count - 1 Debug.Print .Item(i) Next End With End Sub
The following C++ sample displays the list of files being dragged to the control:
#import <exfilevw.dll> void OnOLEDragDropExfileview1(LPDISPATCH Data, long FAR* Effect, short Button, short Shift, long X, long Y) { EXFILEVIEWLib::IExDataObjectPtr spData( Data ); if ( spData ) { EXFILEVIEWLib::IExDataObjectFilesPtr spFiles = spData->Files; for ( long i = 0; i < spFiles->Count; i++ ) OutputDebugString( spFiles->Item[ i ] ); } }
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 displays the list of files being dragged to the control:
Private Sub AxExFileView1_OLEDragDrop(ByVal sender As Object, ByVal e As AxEXFILEVIEWLib._IExFileViewEvents_OLEDragDropEvent) Handles AxExFileView1.OLEDragDrop With e.data.Files Dim i As Long For i = 0 To .Count - 1 Debug.WriteLine(.Item(i)) Next End With End Sub
The following C# sample displays the list of files being dragged to the control:
private void axExFileView1_OLEDragDrop(object sender, AxEXFILEVIEWLib._IExFileViewEvents_OLEDragDropEvent e) { EXFILEVIEWLib.ExDataObjectFiles files = e.data.Files; for (int i = 0; i < files.Count; i++) System.Diagnostics.Debug.WriteLine(files[i]); }
The following VFP sample displays the list of files being dragged to the control:
*** ActiveX Control Event *** LPARAMETERS data, effect, button, shift, x, y With data.Files local i For i = 0 To .Count - 1 wait window nowait .Item(i) Next EndWith