Hide

SftBox/OCX 5.0 - Combo Box Control

Display
Print

OLE Drag & Drop

SftBox/OCX supports OLE drag & drop, based on the OLEDragMode and OLEDropMode settings.

OLE Drag & Drop

If the OLEDragMode property is set to OLEDragSftBoxManual or OLEDragSftBoxAutomatic, OLE drag & drop mechanisms are used. This is the most powerful drag & drop method supported by SftBox/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, SftBox/OCX can be defined as a valid drop target. The OLEDragDrop event occurs when a drop occurs on the control. The Items.DropIndex property describes the item where the drop occurred. The application can retrieve the data and data format using the GetData and GetFormat methods.

SftBox/OCX can also be used as the source of a drag & drop operation. By using the OLEDragMode property (set to OLEDragSftBoxManual or OLEDragSftBoxAutomatic), the OLEStartDrag event occurs as soon as a drag & drop operation is about to begin (either automatically or using the OLEDrag method when the DragStarting event occurs). The DragStarting event only occurs when a drag & drop operation is detected in the edit control portion or the drop down portion.

The DragMode property (in Visual Basic 6) 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 the Container Application

Some containers such as Visual Basic 6 and Visual C++ Visual Basic also support their own drag & drop mechanisms which is not based on OLE. For example, Visual Basic's drag & drop methods only operate within the same application. The DragMode property (added to the control and documented by Visual Basic 6) controls this drag & drop processing. Please see the Visual Basic documentation for more information. Visual C++/MFC offers the COleDropSource and COleDropTarget classes which can be used to implement a drag & drop mechanism.

The DragStarting event can be used to determine the start of a drag & drop operation.

If the OLEDragMode property is set to OLEDragSftBoxManual, SftBox/OCX will generate the DragStarting event which signals the start of a drag & drop operation. The application can then use the CancelMode method to prevent the control's built-in response. The actual implementation of the drag & drop operation can then be delegated to the container.

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. 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 SftBox/OCX. The Items.HitTest and Items.DropIndex properties can be used to visually update the control during a drag & drop operation. When dragging within the control, the drop target can be updated using the 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.