Hide

SftDirectory 3.5 - ActiveX File/Folder Control

Display
Print

SftDirectory.DragStarting Event

The beginning of a drag & drop operation has been detected.

Syntax

VB.NETPrivate Sub object_DragStarting(ByVal sender As Object, ByVal e As EventArgumentType) Handles object.DragStarting
VBPrivate Sub object_DragStarting(ByVal Button As Integer, ByVal Shift As Integer, ByVal xPos As OLE_XPOS_PIXELS, ByVal yPos As OLE_YPOS_PIXELS)
C#.NETvoid object_DragStarting(object sender, EventArgumentType e);
VC++void OnDragStartingobject(short Button, short Shift, OLE_XPOS_PIXELS xPos, OLE_YPOS_PIXELS yPos);
CHRESULT OnDragStartingobject(short Button, short Shift, OLE_XPOS_PIXELS xPos, OLE_YPOS_PIXELS yPos);

object

A SftDirectory object.

Button

Describes the button(s) that are pressed. 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. The bits set indicate the button that caused the event.

ButtonValueDescription
constSftControlLeftButton1The left mouse button was pressed.
constSftControlRightButton2The middle mouse button was pressed.
constSftControlMiddleButton4The right mouse button was pressed.

Shift

Describes the state of the SHIFT, CONTROL and ALT keys. 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. It indicates the state of these keys. Some, all, or none of the bits can be set, indicating which of the keys are pressed.

ShiftValueDescription
constSftControlShiftMask1The SHIFT key is down.
constSftControlCtrlMask2The CONTROL key is down.
constSftControlAltMask4The ALT key is down.

xPos

The x coordinate in pixels where the mouse cursor is located.

yPos

The y coordinate in pixels where the mouse cursor is located.

Comments

The DragStarting event occurs when the beginning of a drag & drop operation has been detected.

The DragStarting event only occurs when the OLEDragMode property is set to OLEDragSftControlManual. An application can implement its own drag & drop processing or use the OLEDrag method in response to this event.

The CurrentFolder property can be used to determine where the drag & drop item starts. It typically includes all selected folders, which can be retrieved using the Selection property and the SelectionCount property.

Examples

VB.NET

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
    AxSftDirectory1.OLEDragMode = SftControlOLEDragModeConstants.OLEDragSftControlManual
End Sub

Private Sub AxSftDirectory1_DragStarting(ByVal sender As Object, ByVal e As AxSftDirectoryLib30._ISftDirectoryEvents_DragStartingEvent) Handles AxSftDirectory1.DragStarting
    Dim F As SftDirectoryFolder
    F = AxSftDirectory1.CurrentFolder
    If Not F Is Nothing Then
        AxSftDirectory1.OLEDrag(False, True, -1, -1)
    End If
End Sub

Private Sub AxSftDirectory1_OLEStartDrag(ByVal sender As Object, ByVal e As AxSftDirectoryLib30._ISftDirectoryEvents_OLEStartDragEvent) Handles AxSftDirectory1.OLEStartDrag
    e.data.Clear()
    e.data.SetData(Nothing, SftOLEClipboardConstants.sftCFText)
    e.allowedEffects = 1 'vbDropEffectCopy

VB6

Private Sub Form_Load()
    SftDirectory1.OLEDragMode = OLEDragSftControlManual
End Sub

Private Sub SftDirectory1_DragStarting(ByVal Button As Integer, ByVal Shift As Integer, _
        ByVal xPos As Single, ByVal yPos As Single)
    Dim F As SftDirectoryFolder
    Set F = SftDirectory1.CurrentFolder
    If Not F Is Nothing Then
        SftDirectory1.OLEDrag False, True, -1, -1
    End If
End Sub

Private Sub SftDirectory1_OLEStartDrag(Data As SftDirectoryLib30.DataObject, _
        AllowedEffects As Long)
    Data.Clear

C#

private void Form1_Load(object sender, System.EventArgs e)
{
    axSftDirectory1.OLEDragMode = SftControlOLEDragModeConstants.OLEDragSftControlManual;
}

private void axSftDirectory1_DragStarting(object sender, AxSftDirectoryLib30._ISftDirectoryEvents_DragStartingEvent e)
{
    SftDirectoryFolder f;
    f = axSftDirectory1.CurrentFolder;
    if (f != null) {
        axSftDirectory1.OLEDrag(false, true, -1, -1);
    }
}

private void axSftDirectory1_OLEStartDrag(object sender, AxSftDirectoryLib30._ISftDirectoryEvents_OLEStartDragEvent e)
{

C++

HCURSOR COLEDragDlg::OnQueryDragIcon()
{
    return (HCURSOR) m_hIcon;
}

BEGIN_EVENTSINK_MAP(COLEDragDlg, CDialog)
    //{{AFX_EVENTSINK_MAP(COLEDragDlg)
    ON_EVENT(COLEDragDlg, IDC_SFTDIRECTORY1, 4 /* DragStarting */, OnDragStartingSftDirectory1, VTS_I2 VTS_I2 VTS_I4 VTS_I4)
    ON_EVENT(COLEDragDlg, IDC_SFTDIRECTORY1, 35 /* OLEStartDrag */, OnOLEStartDragSftDirectory1, VTS_PDISPATCH VTS_PI4)
    ON_EVENT(COLEDragDlg, IDC_SFTDIRECTORY1, 34 /* OLESetData */, OnOLESetDataSftDirectory1, VTS_PDISPATCH VTS_PI2)
    //}}AFX_EVENTSINK_MAP
END_EVENTSINK_MAP()

BOOL COLEDragDlg::OnInitDialog()
{
    CDialog::OnInitDialog();

See Also SftDirectory Object | Object Hierarchy


Last Updated 08/13/2020 - (email)
© 2024 Softel vdm, Inc.