Type | Description | |||
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 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 Data object to provide the data that
need to be dragged to other OLE component. Use the OLEDropMode
property to enable the OLE drag and drop operations in the control.
// OLEStartDrag event is not supported. Use the DragEnter,DragLeave,DragOver, DragDrop ... events. // OLEStartDrag event is not supported. Use the DragEnter,DragLeave,DragOver, DragDrop ... events. |
private void OLEStartDrag(object sender, AxEXMLGRIDLib._IXMLGridEvents_OLEStartDragEvent e) { } void OnOLEStartDrag(LPDISPATCH Data,long FAR* AllowedEffects) { } void __fastcall OLEStartDrag(TObject *Sender,Exmlgridlib_tlb::IExDataObject *Data,long * AllowedEffects) { } procedure OLEStartDrag(ASender: TObject; Data : IExDataObject;var AllowedEffects : Integer); begin end; procedure OLEStartDrag(sender: System.Object; e: AxEXMLGRIDLib._IXMLGridEvents_OLEStartDragEvent); begin end; begin event OLEStartDrag(oleobject Data,long AllowedEffects) end event OLEStartDrag Private Sub OLEStartDrag(ByVal sender As System.Object, ByVal e As AxEXMLGRIDLib._IXMLGridEvents_OLEStartDragEvent) Handles OLEStartDrag End Sub Private Sub OLEStartDrag(ByVal Data As EXMLGRIDLibCtl.IExDataObject,AllowedEffects As Long) End Sub Private Sub OLEStartDrag(ByVal Data As Object,AllowedEffects As Long) End Sub LPARAMETERS Data,AllowedEffects PROCEDURE OnOLEStartDrag(oXMLGrid,Data,AllowedEffects) RETURN |
<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.XMLGrid.1::IExDataObject,AllowedEffects as N) end function function nativeObject_OLEStartDrag(Data,AllowedEffects) return |
The following samples shows how to enable drag and drop operation between exMLGrid control an other controls, using the OLEDropMode property on exOLEDropManual. If the OLEDropMode property is exOLEDropManual the OLEStartDrag and/or OLEDragDrop events must be handled.
The following VB sample enables drag and drop nodes to a text editor:
Private Sub Form_Load() With XMLGrid1 .BeginUpdate .OLEDropMode = exOLEDropManual With .Editors.Add("Float", EditType) .Numeric = exFloat End With With .Editors.Add("DropDown", DropDownListType) .AddItem 1, "Yes" .AddItem 2, "No" End With With .Nodes With .Add("Root").Nodes With .Add("Child 1", "1.2") .Editor = "Float" End With With .Add("Child 2", "1") .Editor = "DropDown" End With End With End With .EndUpdate End With End Sub Private Sub XMLGrid1_OLEStartDrag(ByVal Data As EXMLGRIDLibCtl.IExDataObject, AllowedEffects As Long) AllowedEffects = EXMLGRIDLibCtl.exOLEDropEffectCopy Data.SetData XMLGrid1.FocusNode.Name, EXMLGRIDLibCtl.exCFText End Sub
The following C++ sample enables drag and drop nodes to a text editor:
#include "Node.h" #import <exmlgrid.dll> void OnOLEStartDragXmlgrid1(LPDISPATCH Data, long FAR* AllowedEffects) { *AllowedEffects = EXMLGRIDLib::exOLEDropEffectCopy; if ( EXMLGRIDLib::IExDataObjectPtr spData = Data ) { COleVariant vtValue = m_xmlgrid.GetFocusNode().GetName(); spData->SetData( vtValue, COleVariant( (long)EXMLGRIDLib::exCFText ) ); } }
The #import <exmlgrid.dll> is called to import definitions for ExDataObject and ExDataObjectFiles objects. The #import <exmlgrid.dll> creates the EXMLGRIDLib namespace where all objects and types that eXMLGrid exports. If you need to drag data from eXMLGrid control to a window you need to use RegisterDragDrop API function. The RegisterDragDrop API function registers the specified window as one that can be the target of an OLE drag-and-drop operation and specifies the IDropTarget instance to use for drop operations. Shortly, you need an object that implements the IDropTarget interface, and to call the RegisterDragDrop API function. The OLEStartDrag event is not called if the OLEDropMode property is exOLEDropNone.
The following VB.NET sample enables drag and drop nodes to a text editor:
Private Sub AxXMLGrid1_OLEStartDrag(ByVal sender As Object, ByVal e As AxEXMLGRIDLib._IXMLGridEvents_OLEStartDragEvent) Handles AxXMLGrid1.OLEStartDrag e.allowedEffects = EXMLGRIDLib.exOLEDropEffectEnum.exOLEDropEffectCopy e.data.SetData(AxXMLGrid1.FocusNode.Name, EXMLGRIDLib.exClipboardFormatEnum.exCFText) End Sub
The OLEStartDrag event is not called if the OLEDropMode property is exOLEDropNone.
The following C# sample enables drag and drop nodes to a text editor:
private void axXMLGrid1_OLEStartDrag(object sender, AxEXMLGRIDLib._IXMLGridEvents_OLEStartDragEvent e) { e.allowedEffects = Convert.ToUInt16(EXMLGRIDLib.exOLEDropEffectEnum.exOLEDropEffectCopy); e.data.SetData(axXMLGrid1.FocusNode.Name, EXMLGRIDLib.exClipboardFormatEnum.exCFText); }
The OLEStartDrag event is not called if the OLEDropMode property is exOLEDropNone.
The following VFP sample enables drag and drop nodes to a text editor:
*** ActiveX Control Event *** LPARAMETERS data, allowedeffects allowedeffects = 1 && exOLEDropEffectCopy with thisform.XMLGrid1 data.SetData( .FocusNode.Name, 1 ) && exCFText endwith
The OLEStartDrag event is not called if the OLEDropMode property
is exOLEDropNone.