[Newbies] Quick noob snippets
Bert Freudenberg
bert at freudenbergs.de
Tue May 20 13:17:17 UTC 2008
On 20.05.2008, at 07:01, Herbert König wrote:
> Hello Sven,
>
> don't know about your first Question though people now may think it
> has been replied to.
>
>
> SS> 100 timesRepeat: [randomNo := 100 atRandom. anEllipse height:
> SS> randomNo. anEllipse borderWidth: anEllipse borderWidth + 1 ]
>
> SS>
> SS> It did work but it did the moves all at once. At first I
>
> World doOneCycleNow
> will update the UI and
> (Delay forMilliseconds: 20) wait
> will give you some time to watch every step.
>
> So your loop might look like
>
> 100 timesRepeat: [randomNo := 100 atRandom.
> anEllipse height: randomNo.
> anEllipse borderWidth: anEllipse borderWidth + 1.
> World doOneCycleNow.
> (Delay forMilliseconds: 20) wait]
Note that #doOneCycleNow is a Bad Hack, never to be used in real code,
being punished by <insert favorite tim quote>.
The Right Way to do this in Morphic is to add a #step method in your
own Morph subclass.
- Bert -
More information about the Beginners
mailing list