DragAndDrop
view:DragAndDrop(unit, dragBounds, pinBounds, copy, dragInfo)
Starts the drag and drop process, returning when the dragged item(s) is dropped into a view or into the clipboard; it is usually called from a
ViewClickScript
.
DISCUSSION
- unit
- The stroke unit received by the
ViewClickScript
method.
- dragBounds
- The bounds of the item to be dragged, in global coordinates. The image enclosed by the bounds is used by the clipboard.
- pinBounds
- A bounds frame or
nil
. The bounds to use when constraining the object within the app area. If you passnil
, the drag object's bounds, dragBounds, are used. If the object being dragged is almost the size of the app area, you may want to specify a smaller bounds frame than dragBounds, otherwise the object may not appear to move far enough. If you specify a bounds frame larger that dragBounds, the object cannot be dragged near the edge of the app area.
- copy
Nil
or non-nil
, indicating whether to drag a copy or the original items. Specify non-nil
to drag a copy,nil
to move the original items.
- dragInfo
- An array of frames (one frame per dragged item). Each frame has the following slots:
types
An array of symbols of the types to which an item can be converted.
dragRef
Any valid NewtonScript object. This value is passed to your other methods, such as yourViewGetDropDataScript
.
label
An optional string used when the drop is to the clipboard; it is used as the clipboard label. If this slot is missing and the item has a'text
type, the text data is used as the label; otherwise a default label is used.
minDragDistance
An integer, the minimum distance in pixels that the user must drag the object before it moves. The default is 4.
- return value
- This method returns one of the following integers:
kDragNot
= 0 The item was not dragged at all.
kDragged
= 1 The item was dragged, but was rejected by the destination.
kDragNDropped
= 2 The item was dropped into another view.
The *
DragAndDrop
method sends several messages to both the source view (the view from which *DragAndDrop
was sent) and the destination view (the view that will receive the items). If you want other views to be able to accept data, these views must implement all of the destination methods. If you have more than one view that can receive a drop, it is easier if you make one drop-aware proto and use it for your other views.SEE ALSO
For further information see "Dragging and Dropping with Views" (page 3-40) in Newton Programmer's Guide.
COMPATIBILTY
The dragInfo argument's
minDragDistance
slot is ignored in Newton operating systems prior to Newton 2.1.
Main | Top of Section | What's New | Apple Computer, Inc. | Find It | Feedback | Help