[Squeakland] draw lines, event handling problem

Bert Freudenberg bert at impara.de
Thu Jul 21 02:41:43 PDT 2005


Am 20.07.2005 um 17:17 schrieb Randy Heiland:

> Hi Squeakers (and Tweakers),
>
> I'm hoping someone can help me understand/solve the problem I have  
> with a
> fairly simple project.  Rather than fill mailboxes, I've put it  
> here (under
> Lines segs - Event handling):
>
> http://poincare.uits.iupui.edu/~heiland/squeak/
>
> The project simply tries to draw line segments between 2 points and  
> I'm
> guessing the problem has to do with the way events are handled in  
> Etoys,
> although it could be something else entirely.

Actually, this is caused by your usage of the "do script" tile  
instead of using the line's "dist" script directly.

In this script:

     pt drawto
         pt turn toward e
         line do dist
         pt forward by line's d

the line's "dist" script will only be executed *after* the "drawto"  
script finished. Also, it might not be called *immediately* after  
"drawto", but other scripts might get run in the mean time, too.  
However, it is executed before the next "tick". If you replace the  
"line do dist" tile by dropping the "line dist" tile directly in  
there, it will execute before the "pt forward by line's d" tile.

     pt drawto
         pt turn toward e
         line dist
         pt forward by line's d

Are you even aware of the possibility to use a script dragged  
directly from the viewer as a "statement" tile in another script? If  
not, then we do have a serious user interface problem - the script  
tiles in the viewer surely look different from the "pre-made" tiles.  
But in fact, when making a new script this not any different from the  
premade ones ...

- Bert -



More information about the Squeakland mailing list