|
|
|
OLE Drag & Drop |
SftButton/OCX supports OLE drag & drop, based on the OLEDragMode and OLEDropMode settings.
Events such as the MouseDown event can be used to determine the start of a drag & drop operation.
If the OLEDragMode property is set to OLEDragSftButtonManual, OLE drag & drop mechanisms are used. This is the most powerful drag & drop method supported by SftButton/OCX. In this mode, drag & drop between controls in the same application and between different applications is supported.
Using the OLEDropMode property, SftButton/OCX can be defined as a valid drop target. The OLEDragDrop event occurs when a drop occurs on the control. The application can retrieve the data and data format using the DataObject.GetData and GetFormat methods.
SftButton/OCX can also be used as the source of a drag & drop operation. By using the OLEDragMode property (set to OLEDragSftButtonManual), the OLEStartDrag event occurs as soon as a drag & drop operation is about to begin (initiated by the application using the OLEDrag method).
The DragMode property (in Visual Basic) 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.
Visual Basic also supports its own drag & drop which is not based on OLE. Visual Basic's drag & drop methods only operate within the same application. The DragMode property (added to the control and documented by Visual Basic) controls this drag & drop processing. Please see the Visual Basic documentation for more information.
Other container applications may provide their own drag & drop implementation. For example, Visual C++ offers the C++ classes COleDropSource and COleDropTarget, which offer considerable features to implement OLE Drag & Drop. A suitable event (such as the MouseDown event) could be used to determine when a drag & drop operation starts, but the application can then choose to use the COleDropSource and COleDropTarget classes to implement its own OLE drag & drop mechanisms.