Dragging a line between points
Klaus Major
klaus at major-k.de
Thu Jul 31 17:31:01 EDT 2003
Hi T. R.,
> Hello all,
>
> I've been fiddling with this all afternoon...and I have to be missing
> something obvious. How do I click on one button (representing a "Pin"
> on a connector) and have a straight line follow the mouse until I
> click on another "pin"? The visual effect would be to connect 2
> points together electrically. After the second click...a small
> graphic (of the first Pin) would appear next to the second pin and the
> line should disappear...it's usefullness ended. The user would then
> just continue thru all the pins until all connections were made.
>
> This seems simple, and I thought I had done this with HC yrs ago, but
> can't find the stack.
>
> Thanks in adavnce for any light you can shed on this!
>
> Best Regards,
>
> Tim Ponn
try this like i did ;-)
You need:
1 card
2 buttons "pin" and "endpin"
1 grc, set its layer to 1 or you cannot click the buttons ;-)
In the card script:
global ziehen
on mousemove x,y
global ziehen ## german for may drag ;-)
if ziehen <> true then exit mousemove
set the points of grc 1 to the loc of btn "pin" & CR & x & "," & y
end mousemove
Button "pin":
on mouseUp
global ziehen
put true into ziehen
set the points of grc 1 to empty
## or you may see a flashing of the old grc...
show grc 1
end mouseUp
Button "endpin"
on mouseUp
global ziehen
put false into ziehen
hide grc 1
end mouseUp
Have fun :-)
Hope that helps...
Regards
Klaus Major
klaus at major-k.de
www.major-k.de
More information about the use-livecode
mailing list