Direct Manipulation Basics
It might appear that dragging an icon from one window and dropping it onto
another is straightforward, but on closer consideration it proves to be
somewhat more complex. Consider the simple action of dragging an icon representing
a customer from one container window to another, the intention being to
move the customer from one branch of the business (represented by the first
container) to another (the second container window). The following steps
are required:
The program owning the first container (hereafter
called the source program) must
determine which customer the user wishes to move (hereafter known as the
dragitem).
The source program must decide on an icon or
bitmap to represent the customer as the user drags the customer around the
screen.
The source program must package a number of items
of information to travel with the icon, so that potential target windows
may decide whether or not they will allow the item to be dropped on them.
As the icon passes outside the container to other
areas, its appearance must be constantly updated to indicate to the user
whether a drop is allowed.
When the icon reaches a potential target window,
the program owning the target window (hereafter known as the target)
must access the information about the dragged item to decide whether it
will allow the item to be dropped. At this point, the rendering mechanism
used to convey this information becomes significant, since both the source
and target must be able to understand the mechanism.
Once a drop has occurred, the target window must
decide the form in which it wishes to receive the dropped object (if more
than one form is supported by both source and target), and inform the source
program accordingly.
The source program must make the data representing
the customer available to the target program. Since the source and target
programs may not necessarily run in the same process, this may not be trivial.
Again, the rendering mechanism to be used becomes significant.
The source must inform the target that the data
is ready.
The target must access and retrieve the data.
10.
The source must delete its own copy (since the
operation is a "move" operation).
11.
The
target must display the new customer object in its own container window,
in the location at which it was dropped.
While this appears extremely complex, much of the necessary work is done
by Presentation Manager for a Presentation Manager application; for a Workplace
Shell object, even more of the necessary function is automated by the Workplace
Shell. The remainder of this chapter will describe the steps necessary
for a Presentation Manager application and/or a Workplace Shell object to
exploit drag/drop functionality.
[Back: Direct Manipulation]
[Next: Significant Events]