HeaderPane
Main
Hide

SftTree/OCX 8.0 - ActiveX Tree Control

Share Link
Print

OLEDragDrop Event, SftTree Object

An OLE drag & drop event indicating something has been dropped over the tree control.

Syntax

VB.NETPrivate Sub object_OLEDragDrop(ByVal sender As Object, ByVal e As EventArgumentType) Handles object.OLEDragDrop
VBPrivate Sub object_OLEDragDrop(Data As DataObject, Effect As Long, Button As Integer, Shift As Integer, x As Single, y As Single)
C#.NETvoid object_OLEDragDrop(object sender, EventArgumentType e);
VC++void OnOLEDragDropobject(struct IVDMDataObject** Data, long* Effect, short* Button, short* Shift, float* x, float* y);
CHRESULT OnOLEDragDropobject(struct IVDMDataObject** Data, long* Effect, short* Button, short* Shift, float* x, float* y);

object

A SftTree 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 DataObject.GetData method. The DataObject.SetData and DataObject.Clear methods cannot be used here.

Effect

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).

EffectValueDescription
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.

Button

The button that is pressed during the event (see SftTreeButtonConstants). The button argument is a bit field with bits corresponding to the left button, right button and middle button. These bits correspond to the values shown below. Only one of the bits is set, indicating the button that caused the event.

ButtonValueDescription
constSftTreeLeftButton1The left mouse button was pressed.
constSftTreeRightButton2The right mouse button was pressed.
constSftTreeMiddleButton4The middle mouse button was pressed.

Shift

The state of the SHIFT, CONTROL and ALT keys during the event (see SftTreeKeyConstants). A bit is set if the key is down. The Shift argument is a bit field with bits corresponding to the SHIFT, CONTROL and ALT keys. The Shift variable indicates the state of these keys. Some, all, or none of the bits can be set, indicating which of the keys are pressed.

ShiftValueDescription
constSftTreeShiftMask1The SHIFT key was pressed.
constSftTreeCtrlMask2The CONTROL key was pressed.
constSftTreeAltMask4The ALT key was pressed.

x

The x coordinate of the mouse cursor.

y

The y coordinate of the mouse cursor.

Comments

The OLEDragDrop event occurs indicating something has been dropped over the tree control.

The OLEDragDrop event only occurs if the OLEDropMode property is set to OLEDropSftTreeManual.

The source control should always mask values from the Effect parameter to ensure compatibility with future implementations of drag & drop. Presently, only three bits in the Effect parameter are used. In future versions other bits may be used. As a precaution against future problems, drag sources and drop targets should mask these values appropriately before performing any comparisons.

For example, a source component should not compare an Effect against, for example, vbDropEffectCopy, such as:

If Effect = vbDropEffectCopy...

Instead, the source component should mask the value or values being sought, as here:

If Effect And vbDropEffectCopy = vbDropEffectCopy...

-or-

If (Effect And vbDropEffectCopy)...

This allows for the definition of new drop effects in future versions while preserving compatibility with your existing code.

Examples

VB.NET

    Private Sub DropTargetPic_DragDrop(ByVal sender As Object, ByVal e As System.Windows.Forms.DragEventArgs) Handles DropTargetPic.DragDrop
        Dim arrayOfFormats As [String]() = e.Data.GetFormats(True) ' informational
        If e.Data.GetDataPresent(DataFormats.Bitmap, True) Then
            Dim O As Object = e.Data.GetData(DataFormats.Bitmap, True)
            DropTargetPic.Image = O
        End If
    End Sub

    Private Sub AxSftTree1_OLEDragDrop(ByVal sender As Object, ByVal e As AxSftTreeLib80._DSftTreeEvents_OLEDragDropEvent) Handles AxSftTree1.OLEDragDrop
        ' get horizontal extent and width of column 0
        Dim horzExtent As Integer
        horzExtent = AxSftTree1.Items.HorizontalExtentPix
        Dim firstColumnWidth As Integer
        firstColumnWidth = AxSftTree1.get_Column(0).WidthPix

        Dim insertAt As Integer

C++

        delete pFile;
    }
    return DROPEFFECT_COPY;
}

BEGIN_EVENTSINK_MAP(CDragDropDlg, CDialog)
    //{{AFX_EVENTSINK_MAP(CDragDropDlg)
    ON_EVENT(CDragDropDlg, IDC_SFTTREE1, 24 /* OLEStartDrag */, OnOLEStartDragSftTree1, VTS_PDISPATCH VTS_PI4)
    ON_EVENT(CDragDropDlg, IDC_SFTTREE1, 23 /* OLEDragDrop */, OnOLEDragDropSftTree, VTS_PDISPATCH VTS_PI4 VTS_PI2 VTS_PI2 VTS_PR4 VTS_PR4)
    //}}AFX_EVENTSINK_MAP
END_EVENTSINK_MAP()

BOOL CDragDropDlg::OnWndMsg(UINT message, WPARAM wParam, LPARAM lParam, LRESULT* pResult)
{
    INT_PTR dmResult;
    if (SftDarkMode_HandleDialogMessage(m_hWnd, message, wParam, lParam, &dmResult)) {

See Also SftTree Object | Object Hierarchy


Last Updated 05/24/2026 - (email)
© 2026 Softel vdm, Inc.