[Newbies] Re: Implementing a simple timer

Sean P. DeNigris sean at clipperadams.com
Thu Dec 22 14:47:03 UTC 2011

glenpaling wrote this reply, but it never posted to the list:

I tried your timer, it steps every 10 ms on my system. You've encountered
one of the hazards of subclassing. TextMorph has complex behaviour which
your timer inherits. Somehow, it's overriding the stepTime method. You can
prove this by putting a halt in the stepTime method, it isn't called. 
> Rather than subclass TextMorph you could try making you're timer class
> another, simpler, morph like a RectangleMorph. During initialization, add
> a TextMorph as a subMorph (see code below). Make the step method update
> the time and apply it to the contents of the TextMorph. 
> initialize 
>         super initialize. 
>         time := 0. 
>         textMorph := TextMorph new. 
>         self addMorph: textMorph. 
>         textMorph center: (self center).

View this message in context: http://forum.world.st/Implementing-a-simple-timer-tp4202411p4225472.html
Sent from the Squeak - Beginners mailing list archive at Nabble.com.

More information about the Beginners mailing list