Drawing a Line Graphic
Posted: Wed Jul 04, 2018 2:23 pm
OK...
I feel a little stupid asking this...
I am trying to write a part of an app that draws a line on the card.
It should be simple, and there should be a thousand examples/ tutorials about it, but damned if I can find one!!!
Here's what I want to do:
Click on screen and hold down mouse, start drawing a line, move the mouse to a new location on screen, release mouse button and finish drawing the line.
Simples!
Damned if I can get the right handlers.
script should look something like this:
global tPointsList
on mousedown
put the mouseloc into tPointsList --find the startpoint
end mousedown
on mouseup
put the mouseloc after tPointsList --find the endpoint
set the points of graphic "Line01" to tPointsList --draw the line between startpoint and endpoint
end mouseup
There's obviously more to do to create the line, give it properties etc. but I have found and trested that script...
I gather that mousedown, mouseup doesn't work because I'm mixing/ splitting handlers etc.
DragStart, DragEnd doesn't work because that's a drag and drop thing.
I would be happy with some way of clicking and entering mouseloc into list, then clicking again, and adding to list, but can't work out how to track multiple mouse clicks.
Surely there's an easy way of doing this...
Assistance please?
XdM
I feel a little stupid asking this...
I am trying to write a part of an app that draws a line on the card.
It should be simple, and there should be a thousand examples/ tutorials about it, but damned if I can find one!!!
Here's what I want to do:
Click on screen and hold down mouse, start drawing a line, move the mouse to a new location on screen, release mouse button and finish drawing the line.
Simples!
Damned if I can get the right handlers.
script should look something like this:
global tPointsList
on mousedown
put the mouseloc into tPointsList --find the startpoint
end mousedown
on mouseup
put the mouseloc after tPointsList --find the endpoint
set the points of graphic "Line01" to tPointsList --draw the line between startpoint and endpoint
end mouseup
There's obviously more to do to create the line, give it properties etc. but I have found and trested that script...
I gather that mousedown, mouseup doesn't work because I'm mixing/ splitting handlers etc.
DragStart, DragEnd doesn't work because that's a drag and drop thing.
I would be happy with some way of clicking and entering mouseloc into list, then clicking again, and adding to list, but can't work out how to track multiple mouse clicks.
Surely there's an easy way of doing this...
Assistance please?
XdM