User-Initiated Communication

The latter case is somewhat more complex, since the two objects may have no defined relationship. A conversation must be initiated between the two, whereby each determines the nature of the other, and whether a drop operation is valid at the present time. If so, each object passes the information required to carry out the requested action.

Dragging an Object

When the user begins to drag an object, the object being dragged is notified by the system, which invokes the object's _wpFormatDragItem method. This method is used to build a DRAGITEM structure, which is passed to another object if the current object is dragged over it or dropped upon it. The DRAGITEM structure contains rendering information about the object, which is used by other objects over which the object is dragged, in order to determine whether a drop operation is valid at that point.

Default information for the DRAGITEM structure is inserted by the default processing provided by the parent class, but an object class may override the method and include its own class-specific processing. The DRAGITEM structure is nested within a DRAGINFO structure, which is passed to any object over which the current object is dragged. In a situation where more than one object is being dragged simultaneously, a separate DRAGITEM structure is produced for each object, and the entire set of structures is combined using a single DRAGINFO structure.

When an object is dragged over another object, the system invokes the _wpDragOver method in the object being dragged over. This method receives a DRAGINFO structure, which contains a variety of information including pointers to one or more DRAGITEM structures. The object may examine these structures and determine whether any of the objects being dragged can be dropped over it. If not, the object changes the mouse pointer to indicate that a drop operation is not valid.

Dropping an Object

When a drop operation occurs, the object being dropped upon is notified by the system, which invokes the _wpDrop method. This method accepts the DRAGINFO structure, which may be examined by the object to determine the correct action to be taken. The rendering information contained in the DRAGITEM structure may be sufficient to allow the action to be completed, or the object being dropped upon may initiate a conversation with the object being dragged over it, in order to gain sufficient information to complete the action.

The rendering information provided in the DRAGITEM structure, and its use by a Presentation Manager or Workplace Shell object, is described in detail in Direct Manipulation.


[Back: Application-Initiated Communication]
[Next: Summary]