3 summary:: A simple drag-and-drop source and receiver
5 related:: Classes/DragSink, Classes/DragSource
9 link::Classes/DragSource::, link::Classes/DragSink:: and link::Classes/DragBoth:: are a set of view classes intended as simple-to-use drag-and-drop sources and destinations. They are graphically represented as a simple rectangle, and their specialty is that they emphasis::do not require the Cmd/Ctrl key to be held down to initiate dragging::.
11 Akin to link::Classes/StaticText:: they can store arbitrary content in the link::Classes/StaticText#-object#-object:: variable, and display it using link::Classes/Object#-asString::. You can set the displayed text separately using link::Classes/StaticText#-string#-string::, and keep it independent of the content if you set link::Classes/StaticText#-setBoth#-setBoth:: to code::false::.
13 strong::DragBoth::, specifically, strong::accepts any:: dropped data and stores it into the strong::-object:: variable, as well as gives that variable as data strong::for dragging::.
15 See: link::Classes/View#drag_and_drop:: for a general description of the drag and drop mechanism.
27 METHOD:: defaultGetDrag
28 RETURNS:: The link::Classes/StaticText#-object#-object::.
30 METHOD:: defaultCanReceiveDrag
31 RETURNS:: Allways True.
33 METHOD:: defaultReceiveDrag
34 Sets the link::Classes/StaticText#-object#-object:: to the current drag data.
43 // store various kinds of objects in the drag source
46 a = DragBoth(w, Rect(10, 10, 150, 20)).align_(\center).background_(Color.rand);
47 a.object = "drag us around";
49 a = DragBoth(w, Rect(10, 10, 150, 20)).align_(\center).background_(Color.rand);
50 a.object="SUPERCOLLIDER";
53 a = DragBoth(w, Rect(10, 10, 150, 20)).align_(\center).background_(Color.rand);
54 a.receiveDragHandler = { arg obj; obj.object = View.currentDrag.scramble };