handler to connect buttons with a line
Richmond
richmondmathewson at gmail.com
Mon Oct 31 15:16:39 EDT 2011
Cop a load of this:
put this script in "Button":
on mouseDown
grab me
end mouseDown
on mouseStillDown
put the mouseLoc into VL1
set the loc of me to VL1
put the loc of btn "Button" into line 1 of fld "VL"
put the loc of btn "Button1" into line 2 of fld "VL"
set the points of graphic "line" to fld "VL"
end mouseStillDown
on mouseUp
put the mouseLoc into VL1
set the loc of me to VL1
put the loc of btn "Button" into line 1 of fld "VL"
put the loc of btn "Button1" into line 2 of fld "VL"
set the points of graphic "line" to fld "VL"
end mouseUp
and, surprise, surprise, this script in "Button1":
on mouseDown
grab me
end mouseDown
on mouseStillDown
put the mouseLoc into VL2
set the loc of me to VL2
put the loc of btn "Button" into line 1 of fld "VL"
put the loc of btn "Button1" into line 2 of fld "VL"
set the points of graphic "line" to fld "VL"
end mouseStillDown
on mouseUp
put the mouseLoc into VL2
set the loc of me to VL2
put the loc of btn "Button" into line 1 of fld "VL"
put the loc of btn "Button1" into line 2 of fld "VL"
set the points of graphic "line" to fld "VL"
end mouseUp
Still fairly clunky, but a lot better than my first effort. The secret
lies in the 'mouseStillDown' thing .. . :)
Richmond.
More information about the use-livecode
mailing list