ComponentOne True DBInput Pro 8.0
OLE Drag and Drop

True DBInput Pro 8.0 controls comply with the ActiveX standard, which means they are capable of handling OLE drag and drop operations from other applications or even the Windows shell. OLE Drag and Drop support is provided via a number of methods and events that work together to support both sides of a drag-and-drop conversation; the object being dragged, or "source" and the object receiving the drag, or "target".

In an OLE drag and drop situation, there are 2 groups of events that occur; Drag Side events and Drop Side events. Together these two groups constitute all the communication that goes on between the drag and drop source and target. The execution of these events is as follows:

Drag Side (source control)

To start a drag and drop operation, call the OLEDrag method. This initiates the drag and drop and fires an OLEStartDrag event in the source control.

The OLEStartDrag event receives parameters that include a DataObject object. This is an object that serves as the container for whatever information is being transferred by the drag-and-drop operation. The DataObject object can be queried to provide information about what is being dragged and what data types are supported. You also receive an effects parameter that tells it what types of operations are allowed. Possible effects are none, move, copy, and scroll.

As the mouse pointer with the dragging object moves, multiple OLEGiveFeedback events are fired. The event is passed an effect parameter, as well as a boolean defaultcursors parameter that determines whether to display default or custom mouse pointers as the mouse moves. This event is used to determine when the dragging object is over a suitable target.

Drop Side (target control)

When a dragging object enters the control that is a possible target, the OLEDragOver event for the target control is fired.

When the mouse button is released, an OLEDragDrop event is fired in the target control.

Drag Side (source control)

If the drag and drop target needs more information than was supplied with the object (in OLEStartDrag) it will cause the OLESetData event to be fired in the source control. The source control can use this event to continue the conversation by supplying additional data.

When the object is dropped, an OLECompleteDrag event is fired in the source control.

Note that to handle an object being dragged from Windows itself or another application, only the drop side of the conversation must be implemented in your program. Similarly, if your application will be acting only as a source of draggable objects, you will only need to implement the drag side of the operation.

 

 


Copyright (c) GrapeCity, inc. All rights reserved.

Product Support Forum  |  Documentation Feedback