Draw with pencil tool from a script to produce wiggly line?

Anything beyond the basics in using the LiveCode language. Share your handlers, functions and magic here.

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
GeoffRev
Posts: 4
Joined: Wed Jul 18, 2007 12:08 pm

Draw with pencil tool from a script to produce wiggly line?

Post by GeoffRev » Thu Aug 16, 2007 1:53 pm

I want to draw a line graph from a script.
I have an image area which I can write on using the mouse, but cannot move the pencil tool from a script and hence produce the graph line. I remember doing this in HyperCard.
Of course there may be another way of doing this ... suggestions welcomed

Thanks

Klaus
Posts: 14206
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Post by Klaus » Thu Aug 16, 2007 2:12 pm

Hi Geoff,

try this:

Code: Select all

on mouseUp
  choose pencil tool
  drag from "10,10" to "100,10"
end mouseUp
And replace the coordinates with yours.
Tested and works :-)


Best

Klaus

GeoffRev
Posts: 4
Joined: Wed Jul 18, 2007 12:08 pm

Post by GeoffRev » Thu Aug 16, 2007 3:00 pm

Thanks Klaus. I did try drag from .. to ... but couldn't get it to work earlier. Now it's OK.

You don't happen to know how to clear an image do you? :-)

Klaus
Posts: 14206
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Post by Klaus » Thu Aug 16, 2007 3:15 pm

Hi Geoff,

yes I do :-)


Best

Klaus

Klaus
Posts: 14206
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Post by Klaus » Thu Aug 16, 2007 3:16 pm

Hi geoff,

erm... oops...

...
put empty into img "You image here"
...


:-)

GeoffRev
Posts: 4
Joined: Wed Jul 18, 2007 12:08 pm

Post by GeoffRev » Thu Aug 16, 2007 3:40 pm

Ah, ha ... tried this and my background colour disappears!

and
set backgroundcolor of img "my image here" to "White"
doesn't do anything.

Hmmmm .... setting the 'second color' in the object inspector doesn't change anything either ... it's not obvious what I doing wrong ... or is it? :-)

Klaus
Posts: 14206
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Post by Klaus » Thu Aug 16, 2007 3:56 pm

Hi Geoff,

well your question was how to clear an image, and that's what my line does completely emptying the image ;-)

Sorry, I don't think you can clear certain parts of your image.
Maybe you can try an "undo" right after the last editing?
I'm not sure, but its worth a try:

Code: Select all

on mouseup
  undo
end mouseup

Best

Klaus

GeoffRev
Posts: 4
Joined: Wed Jul 18, 2007 12:08 pm

Post by GeoffRev » Thu Aug 16, 2007 4:09 pm

solution found!

put empty into img "image name"
choose bucket tool
click at the loc of img "image name"

phew! Thanks for your help.

Geoff

Klaus
Posts: 14206
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Post by Klaus » Thu Aug 16, 2007 4:14 pm

Ah yes, if you only need the backgroundcolor in your image... :-)

Post Reply