Hide

SftTree/OCX 7.5 - ActiveX Tree Control

Display
Print

Drag & Drop

SftTree/OCX supports three different types of drag & drop, based on the DragMethod settings.

OLE Drag & Drop

If the DragMethod property is set to dragSftTreeOLE, OLE drag & drop mechanisms are used. This is the most powerful drag & drop method supported by SftTree/OCX. In this mode, drag & drop between controls in the same application and between different applications is supported, including drag & drop to and from Windows Explorer.

Using the OLEDropMode property, SftTree/OCX can be defined as a valid drop target. The OLEDragDrop event occurs when a drop occurs on the tree control. The Items.DropHighlight property describes the item where the drop occurred. The application can retrieve the data and data format using the DataObject.GetData and DataObject.GetFormat methods.

SftTree/OCX can also be used as the source of a drag & drop operation. By using the DragMethod property (set to dragSftTreeOLE), the OLEStartDrag event occurs as soon as a drag & drop operation is about to begin. The DragType property defines how a drag & drop operation can be started by the user. The DragMode property must be set to vbManual for OLE drag & drop. In the OLEStartDrag event, the application can define the data or data formats and drop effects that are supported for the drag & drop operation.

Drag & Drop Controlled by SftTree/OCX

If the DragMethod property is set to dragSftTreeAuto, SftTree/OCX handles all drag & drop operations within one tree control. This mode is not suitable for drag & drop between different tree controls or applications in general. It is intended for environments where the container application (e.g. Visual Basic, Visual C++, etc.) does not support drag & drop between controls. SftTree/OCX generates the events AutoDragging, AutoEndDragging and AutoCancelDragging to notify the application about the progress of the drag & drop operation.

Drag & Drop Controlled by the Container Application

If the DragMethod property is set to dragSftTreeManual, SftTree/OCX does not handle the drag & drop operations. SftTree/OCX supports a drag & drop protocol by generating a DragStarting event when the user initiates a drag & drop operation. 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.

Some host environments may not implement the required events and properties to drag to another tree control or control type. Some environments may not even support drag & drop operations at all. Please see the documentation that came with your development environment for more information.

Environments that support the necessary methods and events can make use of the drag & drop support built into SftTree/OCX. The Items.HitTest and Items.DropHighlight properties can be used to visually update the tree control during a drag & drop operation. When dragging within the tree control, the drop target can be updated using the Items.DropHighlight property, which causes automatic scrolling vertically when the mouse cursor moves to the first or last visible item.


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