DragAndDropLtd
view:DragAndDropLtd(unit, dragBounds, limitBounds, copy, dragInfo) //platform file function
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
.
Call it using this syntax:
- 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.
- limitBounds
- A bounds frame, or a frame with two optional slots:
limitBounds
andpinBounds
. If you specify a bounds frame, it is the bounds in global coordinates in which the object can be dragged.
- Otherwise, you may pass in a frame with the following slots:
limitBounds
A bounds frame, the symbol'none
, ornil
. The bounds frame is a rectangle in global coordinates in which the object can be dragged. The symbol'none
specifies that there is no limiting rectangle, and the object can be dragged anywhere on the screen. If you passnil
(or do not include alimitBounds
slot) the app area is used as the limiting rectangle.
pinBounds
A bounds frame, the symbol'none
, ornil
. The bounds to use when constraining the object within the limiting rectangle defined in thelimitBounds
slot. If you passnil
, the drag object's bounds, dragBounds, are used. If you pass'none
, an empty rectangle (with 0 width and height) is specified at the point where the pen went down to drag the object; that is, the object moves until the tip of the pen reaches the limit bounds.If the object being dragged is small, compared to the size of the
limitBounds
, you may want to specify apinBounds
smaller 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 thelimitBounds
.
- copy
Nil
or non-nil
, indicating whether to drag a copy or the original items. Specify non-nil
to drag a copy, ornil
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.
IMPORTANT - This function is not defined in all ROM versions and is supplied by the NTK Platform file. This implementation, as a global function, and not as a view method, requires an additional argument view, the view calling this function.
call kDragAndDropLtdFunc with (view, unit, dragBounds, limitBounds, copy, dragInfo));
DISCUSSION
The *DragAndDropLtd method sends several messages to both the source view (the view from which *DragAndDropLtd 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.
Main | Top of Section | What's New | Apple Computer, Inc. | Find It | Feedback | Help