SftMask/OCX 7.0 Documentation

Display
Print

OLEStartDrag Event, SftMask Object

Source object is starting an OLE drag & drop operation.

Syntax

VB.NETPrivate Sub object_OLEStartDrag(ByVal sender As Object, ByVal e As EventArgumentType) Handles object.OLEStartDrag
VBPrivate Sub object_OLEStartDrag(Data As DataObject, AllowedEffects As Long)
C#.NETvoid object_OLEStartDrag(object sender, EventArgumentType e);
VC++void OnOLEStartDragobject(struct IVDMDataObject** Data, long* AllowedEffects);
CHRESULT OnOLEStartDragobject(struct IVDMDataObject** Data, long* AllowedEffects);

object

A SftMask 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.

AllowedEffects

A Long variable set by the source object identifying all effects it supports. This parameter must be correctly set by the target component during this event. The value of Effect is determined by logically Or'ing together all active effects. The target component should check these effects and other parameters to determine which actions are appropriate for it, and then set this parameter to one of the allowable effects (as specified by the source) to specify which actions will be performed if the user drops the selection on the component.

AllowedEffectsValueDescription
vbDropEffectNone0Drop target cannot accept the data.
vbDropEffectCopy1Drop results in a copy of data from the source to the target. The original data is unaltered by the drag operation.
vbDropEffectMove2Drop results in data being moved from the drag source to the drop source. The drag source should remove the data from itself after the move.

Note: Only Visual Basic offers the predefined constants vbDropEffectNone, etc. When using other languages, the constants have to be defined explicitly by the application.

Comments

The OLEStartDrag event occurs when source object is starting an OLE drag & drop operation.

This event specifies the data formats and drop effects that the source component supports. It can also be used to insert data into the DataObject object.

You may want to defer placing data into the DataObject object until the target component requests it. This allows the source component to save time by not loading multiple data formats. When the target performs the GetData method on the DataObject, the source's OLESetData event will occur if the requested data is not contained in the DataObject. At this point, the data can be loaded into the DataObject, which will in turn provide the data to the target.

If the user does not load any formats into the DataObject using SetData, the drag & drop operation is cancelled.

AllowedEffects must be set to vbDropEffectCopy or vbDropEffectMove, otherwise the drag & drop operation is cancelled.

Examples

VB.NET

End Sub

Private Sub AxAxSftMask1_DragStarting(ByVal sender As Object, ByVal e As AxSftMaskLib70._ISftMaskEvents_DragStartingEvent) Handles AxSftMask1.DragStarting
    If AxSftMask1.SelLength <> 0 Then
        AxSftMask1.OLEDrag()
    End If
End Sub

Private Sub AxAxSftMask1_OLEStartDrag(ByVal sender As Object, ByVal e As AxSftMaskLib70._ISftMaskEvents_OLEStartDragEvent) Handles AxSftMask1.OLEStartDrag
    e.data.Clear()
    e.data.Files.Add(AxSftMask1.SelText)
    e.data.SetData(Nothing, SftOLEClipboardConstants.sftCFFiles)
    e.allowedEffects = 1 ' vbDropEffectCopy
End Sub

VB6

End Sub

Private Sub SftMask1_DragStarting(ByVal Button As Integer, ByVal Shift As Integer, ByVal x As Single, ByVal y As Single)
    If SftMask1.SelLength <> 0 Then
        SftMask1.OLEDrag
    End If
End Sub

Private Sub SftMask1_OLEStartDrag(Data As SftMaskLib70.DataObject, AllowedEffects As Long)
    Data.Clear
    Data.Files.Add SftMask1.SelText
    Data.SetData , sftCFFiles
    AllowedEffects = vbDropEffectCopy
End Sub

C#

private void axSftMask1_DragStarting(object sender, AxSftMaskLib70._ISftMaskEvents_DragStartingEvent e)
{
    if (axSftMask1.SelLength != 0) {
        axSftMask1.OLEDrag();
    }
}

private void axSftMask1_OLEStartDrag(object sender, AxSftMaskLib70._ISftMaskEvents_OLEStartDragEvent e)
{
    e.data.Clear();
    e.data.Files.Add(axSftMask1.SelText, null);
    e.data.SetData(null, SftOLEClipboardConstants.sftCFFiles);
    e.allowedEffects = 1; //vbDropEffectCopy
}

C++

void CProject1Dlg::OnDragStartingSftMask1(short Button, short Shift, float x, float y)
{
    if (m_pMask1->SelLength != 0) {
        m_pMask1->OLEDrag();
    }
}

void CProject1Dlg::OnOLEStartDragSftMask1(LPDISPATCH FAR* Data, long FAR* AllowedEffects)
{
    IVDMDataObjectPtr pData = *Data;
    pData->Clear();
    pData->Files->Add(m_pMask1->SelText);
    pData->SetData(vtMissing, _variant_t((long) sftCFFiles));
    *AllowedEffects = DROPEFFECT_COPY;
}

See Also SftMask Events | Object Hierarchy


Last Updated 09/02/2018 - (email)
© 2019 Softel vdm, Inc.