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 Background( exScheduleOLEDropPosition) property specifies the visual appearance of the line to be shown when the cursor is hovering the schedule part of the control, during an OLE drag and drop operation.
The settings for AllowEffects are:
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 exCFFiles and Files property to add files to the drag and drop data object.
The idea of drag and drop in exSchedule control is the same as in other
controls. To start accepting drag and drop sources the exSchedule control MUST
have the OLEDropMode property to exOLEDropManual.
Once that is is set, the exSchedule starts accepting any drag and drop
sources.
The first step is if you want to be able to drag items from your exSchedule
control to other controls the idea is to handle the OLE_StartDrag event. The
event passes an object ExDataObject (Data) as argument. The Data and
AllowedEffects can be changed only in the OLEStartDrag event. The
OLE_StartDrag event is fired when user is about to drag items from the
control. The AllowedEffect parameter and SetData
property must be set to continue drag and drop operation, as in the following
sample:
// 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, AxEXSCHEDULELib._IScheduleEvents_OLEStartDragEvent e) { } void OnOLEStartDrag(LPDISPATCH Data,long FAR* AllowedEffects) { } void __fastcall OLEStartDrag(TObject *Sender,Exschedulelib_tlb::IExDataObject *Data,long * AllowedEffects) { } procedure OLEStartDrag(ASender: TObject; Data : IExDataObject;var AllowedEffects : Integer); begin end; procedure OLEStartDrag(sender: System.Object; e: AxEXSCHEDULELib._IScheduleEvents_OLEStartDragEvent); begin end; begin event OLEStartDrag(oleobject Data,long AllowedEffects) end event OLEStartDrag Private Sub OLEStartDrag(ByVal sender As System.Object, ByVal e As AxEXSCHEDULELib._IScheduleEvents_OLEStartDragEvent) Handles OLEStartDrag End Sub Private Sub OLEStartDrag(ByVal Data As EXSCHEDULELibCtl.IExDataObject,AllowedEffects As Long) End Sub Private Sub OLEStartDrag(ByVal Data As Object,AllowedEffects As Long) End Sub LPARAMETERS Data,AllowedEffects PROCEDURE OnOLEStartDrag(oSchedule,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.Schedule.1::IExDataObject,AllowedEffects as N) end function function nativeObject_OLEStartDrag(Data,AllowedEffects) return |
The following VB sample collects the focused/selected events and start dragging them ( you can drop them to a WinWord, Excel application for instance ):
Private Sub Schedule1_OLEStartDrag(ByVal Data As EXSCHEDULELibCtl.IExDataObject, AllowedEffects As Long) With Schedule1 Dim e As EXSCHEDULELibCtl.Event Set e = .EventFromPoint(-1, -1) If Not e Is Nothing Then Dim sDragDropText As String If Not (e.Selected) Then sDragDropText = sDragDropText & "Start: " & e.Start & ", End: " & e.End & vbCrLf Else Dim s As Variant For Each s In .Selection sDragDropText = sDragDropText & "Start: " & s.Start & ", End: " & s.End & vbCrLf Next End If AllowedEffects = 1 Data.SetData sDragDropText End If End With End Sub