Menu

#76 Drag+Drop: receiveDragHandler not called with mouse coords

open
nobody
SC Classes (22)
5
2010-09-28
2010-09-28
Anonymous
No

SCView Helpfile says:

receiveDragHandler_(arg1)
receiveDragHandler This is where you deterimine what a view will do when it receives a drag. If this variable is nil (the default), defaultReceiveDrag is called instead. See also addAction (func, selector) above.
arg1 - An instance of Function or FunctionList. The function is passed the following argument list: view, x, y. Typically it will then precess currentDrag in some way.

Test example:
(
w = Window.new("", Rect(300,300,400,400)).front;
b = Button(w, Rect(0,0,100,18))
.states_([["drag me", Color.black, Color.white]]);
u = UserView(w, Rect(0,20,400,380)).background_(Color.yellow);
u.canReceiveDragHandler_{ true };
u.receiveDragHandler_{|uview, x, y|
"drag received!".postln;
"X: ".post; x.postln;
"Y: ".post; y.postln;
};
)

Discussion


Log in to post a comment.

MongoDB Logo MongoDB