Re: Click with brush

Scott Raney ((no email))
Wed, 12 Apr 1995 10:29:52 -0600 (MDT)

>
> --------
> I have script that paints stars on a map of the sky. Weirdly, the repeat loop
> which includes a click at x,y statement, clicks (the first time) NOT at x,y
> but on the place on the button (which contains the handler) where I clicked.
> All subsequent clicks in the loop are at the right places.
>
> Anyone know anything about weird brush clicks?

This is a bug. I'm assuming that you're deleting the image and then
letting it be recreated automatically on the first click. The problem
is that the image doesn't get the mouse position when it gets created
this way, so it just uses the global mouse position rather than the
synthetic position you're sending with "click".

Note that your design won't work in the non-Home stack environment
anyway, since controls can't be created. A better design is to create
the image manually by clicking on it with the brush tool and then
erasing the dot so that the image already exists when you run your
"stars" script. Unfortunately, this means that to generate a new
pattern of stars you'll have to keep track of the old one so that you
can erase the old stars before drawing the new ones.

An even better design would be to set the "points" property of a
graphic and set the markerPoints property so that they look like
stars. This will be a couple of orders of magnitude faster than using
images, uses far less memory and disk space, and works in the non-Home
stack environment. See the demo stack for some examples of how to set
the points property of a graphic. The trick in your case is to put a
empty lines between the points so that the stars aren't connected by a
line.

Thanks for the report!
Scott

> Steve Tripp
>
>

-- 
***********************************************************************
* Scott Raney  303-447-3936            Remember: the better you look, *
* raney@metacard.com                   the more you'll see -- Lidia   *
***********************************************************************