Hide

SftTree/OCX 7.5 - ActiveX Tree Control

Display
Print

DragStarting Event, SftTree Object

The user initiates a drag & drop operation.

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)
C#.NETvoid object_DragStarting(object sender, EventArgumentType e);
VC++void OnDragStartingobject(short Button, short Shift);
CHRESULT OnDragStartingobject(short Button, short Shift);

object

A SftTree object.

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.
constSftTreeRightButton 1)2The right mouse button was pressed.
constSftTreeMiddleButton 1)4The 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.

Comments

The DragStarting event occurs when the user initiates a drag & drop operation.

1) Depending on the settings of the LeftButtonOnly properties, this event may not be generated for the middle and right mouse buttons.

This event is only available if the DragMethod property is set to dragSftTreeManual and is suitable for drag & drop within one tree control or between multiple controls. The container (i.e. Visual Basic, Visual C++, etc.) must implement the necessary drag & drop support (see DragMethod). The DragStarting event is only used to signal that the user has requested a drag & drop operation. The actual implementation of the drag & drop operation is delegated to the container, which must support drag & drop between controls.

The tree control generates the DragStarting event when the user starts a drag & drop operation. The DragType property determines when a drag & drop operation is started.

A drag & drop operation always starts at the current location described by the Items.Current property. It is the application's responsibility to visually implement the drag & drop operation. When the operation involves the current tree control, this is accomplished by using the Items.HitTest method and the Items.DropHighlight property. If dragging to another tree control, the target tree control's Items.HitTest method and Items.DropHighlight property have to be used. If dragging to another control type (list box, edit control, etc.), other means may have to be used as implemented by the target control.

Note: Some host environments may not implement the required events and properties to drag to another control or control type. Some environments may not even support drag & drop operations at all. The Drag method used in the DragStarting event below is environment specific and not implemented by the tree control. Your environment's approach to initiating a drag & drop operation may involve another methods or may not be available at all. Please see the documentation that came with your development environment for more information about drag & drop.

Examples

VB.NET

        i = AxSftTree1.Items.Add("Item 1")
        AxSftTree1.get_Item(i).Level = 1
        i = AxSftTree1.Items.Add("Item 2")
        AxSftTree1.get_Item(i).Level = 2
        i = AxSftTree1.Items.Add("Item 3")
        AxSftTree1.get_Item(i).Level = 1
    End Sub

    Private Sub AxSftTree1_DragStarting(ByVal sender As Object, ByVal e As AxSftTreeLib75._DSftTreeEvents_DragStartingEvent) Handles AxSftTree1.DragStarting
        AxSftTree1.CancelMode()    ' .NET controls drag&drop, so tree control needs to cancel

        ' This section demonstrates drag (&drop) using the .NET DoDragDrop method
        ' THIS CODE IS ONLY USED IF DRAGMETHOD IS SET TO  ( 1 - Manual ) or SftTreeDragMethodConstants.dragSftTreeManual

        Dim curr As Integer
        curr = AxSftTree1.Items.Current

C#

            i = axSftTree1.Items.Add("Item 1");
            axSftTree1.get_Item(i).Level = 1;
            i = axSftTree1.Items.Add("Item 2");
            axSftTree1.get_Item(i).Level = 2;
            i = axSftTree1.Items.Add("Item 3");
            axSftTree1.get_Item(i).Level = 1;
        }

        private void axSftTree1_DragStarting(object sender, AxSftTreeLib75._DSftTreeEvents_DragStartingEvent e) {

            axSftTree1.CancelMode();    // .NET controls drag&drop, so tree control needs to cancel

            // This section demonstrates drag (&drop) using the .NET DoDragDrop method
            // THIS CODE IS ONLY USED IF DRAGMETHOD IS SET TO  ( 1 - Manual ) or SftTreeDragMethodConstants.dragSftTreeManual

            int curr = axSftTree1.Items.Current;

See Also SftTree Object | Object Hierarchy


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