use-revolution digest, Vol 1 #1701 - 16 msgs

Jim Hurley jhurley at infostations.com
Thu Jul 31 19:08:01 EDT 2003


>
>Message: 12
>Date: Thu, 31 Jul 2003 16:14:25 -0400
>From: "T. R. Ponn" <alptex2 at orwell.net>
>Organization: ALPTEX, Inc.
>To: use-revolution at lists.runrev.com
>Subject: Dragging a line between points
>Reply-To: use-revolution at lists.runrev.com
>
>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

Tim,

The following button script will get you started. It will draw the 
line from the button to the point at which you release the mouse, 
perhaps over a second button. You can use the second button to erase 
the line (set the points of graphic "tLine" to empty.)

local myName,tStart

on mouseDown

   if there is no graphic "theLine" then
     set the style of the templateGraphic to "line"
     create graphic theLine
   end if

   set the endArrow of the graphic "theLine" to "true"
   put the loc of me into tStart
   put the name of me into myName
end mouseDown

on mouseMove x,y
   if myName is "" then exit mouseMove
   put x,y into tEnd
   set the points of graphic "theLine" to tstart & return & tEnd
end mouseMove

on mouseUP
   put "" into myName
end mouseUP

on mouseRelease
   put "" into myName
end mouseRelease

Jim



More information about the use-livecode mailing list