Page 1 of 1

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

Posted: Thu Aug 16, 2007 1:53 pm
by GeoffRev
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

Posted: Thu Aug 16, 2007 2:12 pm
by Klaus
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

Posted: Thu Aug 16, 2007 3:00 pm
by GeoffRev
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? :-)

Posted: Thu Aug 16, 2007 3:15 pm
by Klaus
Hi Geoff,

yes I do :-)


Best

Klaus

Posted: Thu Aug 16, 2007 3:16 pm
by Klaus
Hi geoff,

erm... oops...

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


:-)

Posted: Thu Aug 16, 2007 3:40 pm
by GeoffRev
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? :-)

Posted: Thu Aug 16, 2007 3:56 pm
by Klaus
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

Posted: Thu Aug 16, 2007 4:09 pm
by GeoffRev
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

Posted: Thu Aug 16, 2007 4:14 pm
by Klaus
Ah yes, if you only need the backgroundcolor in your image... :-)