draw line to mouseLoc under script control

Sarah Reichelt sarahr at genesearch.com.au
Tue Jan 4 16:52:57 EST 2005


> I want to create a vocabulary drill in which a word in the left column 
> is to be connected to it's definition in the right column.  You might 
> remember doing this on paper in elementary school.  There are a number 
> of ways to do the UI--in this case I want the student to draw a line 
> (by dragging) from a radio button on the left side to a radio button 
> on the right side (or vice versa).  I'd prefer the start and end 
> points of the line to snap to the loc of the radio buttons.
>
Try having mouseDown and mouseUp handlers in the card script. In the 
mouseDown, if the mouse is within the rect of one of the starting radio 
buttons, store that button's name or ID. In mouseUp, check again and if 
the mouse is within the rect of one of the ending radio buttons, create 
a new graphic. Set it's style to line and it's points to the locs of 
both buttons (one per line).

You may need to do some more settings on the line, but that should be 
enough to get you started.

Cheers,
Sarah



More information about the Use-livecode mailing list