Arguments: widget
Initiates a dragging operation from widget. The user may "drop" onto another control by clicking the mouse to associate the two controls together in some way.
The drag continues until the user "drops" by either pressing a mouse button (if no mouse buttons were down when drag-and-drop was called), releasing a mouse button (if a mouse button was down when drag-and-drop was called), or pressing ESCAPE to cancel the drag.
During this time, the mouse cursor changes to indicate whether a drop is allowed at the current mouse cursor location. A drop is allowed whenever the mouse cursor is over a control where droppable-p returns true when called on the dragged control and that dropped-onto control.
The default droppable-p method returns true
when over any control other than the dragged control, and true when
over the dragged control itself if droppable-onto-self returns true
for it. The default droppable-onto-self method returns
nil
.
By convention, drag-and-drop should not be called for a particular control if
(draggable-p control)
returns nil
. The default draggable-p method
returns true for any control.
If the user drops where a drop is allowed, then good-drop is called; if the user drops elsewhere, then bad-drop is called; if the user cancels by pressing ESCAPE, then neither function is called.
An application will typically add draggable-p methods to determine which controls may be dragged from, droppable-p methods to determine which controls may be dropped onto which, and good-drop methods to process successful drops.
drag-and-drop
returns the control that was dropped onto if any, or nil
otherwise. There is no dropped-onto control if
the user either cancels the drag by pressing ESCAPE or drops at a
location that is not over any control.
By default, the only visual indication that a drag is taking place is the changing mouse cursor. This is the standard drag-and-drop approach in Windows. But if
(drag-images (configuration*system*
))
is set to true, then an attempt is made to drag an image of some part of the dragged-from control. This image is obtained by calling box-to-drag on the dragged-from control and copying pixels from the screen for that section of the control. box-to-drag methods are supplied for most of the controls to specify the area occupied by the currently selected value of the control. Note that this approach will not work well if the current value of the control is ever scrolled out of view. Depending on which types of controls are being dragged from, these images may or may not be considered sufficiently aesthetic for an application's interface, and so this dragging option should not be used if the result is unsatisfactory.
When the IDE is running, drag-and-drop is called if the ALT key is held down and a left click and drag is done over a control. At this time, however, the IDE does not actually use drag-and-drop, and dropping onto arbitrary IDE controls can lead to errors. This gesture is defined in the IDE only for experimental purposes. It is not defined in standalone images, and applications must define their own gestures to call drag-and-drop.
Common Graphics and IDE documentation is described in About Common Graphics and IDE documentation in cgide.htm.
The documentation is described in introduction.htm and the index is in index.htm.
Copyright (c) 1998-2000, Franz Inc. Berkeley, CA., USA. All rights reserved.
Created 2000.10.5.