Question about flushing Display on Canvas
Lex Spoon
lex at cc.gatech.edu
Tue May 3 15:29:58 UTC 2005
> > It would be great if there were a way that was as easy to draw in
> > Morphic as Milan is seeking. If you draw onto the Display directly,
> > Squeak is smart enough to flush things immediately as you draw. It's
> > not fast, but it's easy to use and understand. On the other hand, if
> > you play by Morphic's rules, then what can you do?
>
> Implement a drawOn: method ;-)
Yes, that's what people should eventually learn, but think way back to
before you were comfortable programming GUI's... Many people have a
hard time thinking about this idea that a widget is passive and waits to
be asked to draw itself. Many people would like to write code along the
lines of:
1. compute a new point to draw.
2. draw it.
3. go to 1.
Or maybe:
Whenever a building is destroyed, draw an explosion on top of it.
Or:
Every 10 milliseconds, draw a new square at a random place.
These are awkward for a beginner in Squeak right now. Before you can
implement them, you have to code up some extra infrastructure to manage
a form behind the scenes.
On further thought, though, there actually is a way to do this in Squeak
right now: using addMorph:. Instead of drawing an ellipse, add an
EllipseMorph to the right location. There are (or should be) morphs for
all of the canvas commands....
-Lex
More information about the Squeak-dev
mailing list
|