[squeak-dev] Morph doesn't paint on every tick?
Lou at Keystone-Software.com
Wed Dec 27 03:13:45 UTC 2017
Thanks for the answer. I will give:
a try tomorrow. #stepTime returns 1000. The code is called every second. I have checked with
messages to the transcript. The method #displayDateTimeHeader is called every second. It
clears the area. Most of the text is repeated until the minute changes but the seconds change
with every call. I don't understand why it doesn't redraw. I may be breaking some rule with
how the morph is defined. If so, I'm not sure what it is. If sending self changed doesn't
work, maybe I will post a fileout of the whole morph, if you would be kind enough to take a
On Tue, 26 Dec 2017 20:00:56 -0500, Bob Arning <arning315 at comcast.net> wrote:
>Morphs redraw when something has changed -- not much point in wasting
>cycles if everything is the same. So somewhere, like the Calendar... or
>an inner morph that only contains the time needs 2 methods like:
> self changed
> ^1000 "or less"
>On 12/26/17 7:22 PM, Louis LaBrunda wrote:
>> Hi All,
>> I'm making a CalendarDisplayMorph. The code below is called every second. I'm sure it is
>> being called every second. But the seconds don't change every second. It does change if I
>> click on the morph and select or move it or something.
>> I'm testing it with this:
>> (TransformationMorph new asFlexOf: CalendarDisplayMorph new) openInWorld.
>> What am I missing?
>> "Display the date and time in the header."
>> | font rect canvas fWidth weekDay dateString timeString |
>> font := TextStyle default fontOfSize: 96.
>> fWidth := self extent x.
>> canvas := destForm getCanvas.
>> rect := Rectangle origin: 0 at 0 extent: fWidth at headerHeight.
>> canvas frameAndFillRectangle: rect fillColor: self cellColor borderWidth: 2 borderColor: self
>> currentDate := DateAndTime now.
>> weekDay := currentDate dayOfWeekName asString.
>> self drawString: weekDay centeredIn: rect vOffset: 5 withFont: font color: self textColor.
>> dateString := currentDate monthName, ' ', currentDate dayOfMonth printString, ', ',
>> currentDate year printString.
>> self drawString: dateString centeredIn: rect vOffset: 35 withFont: font color: self
>> timeString := String streamContents: [:aStream | currentDate asTime print24: false
>> showSeconds: true on: aStream].
>> self drawString: timeString centeredIn: rect vOffset: 65 withFont: font color: self
Keystone Software Corp.
More information about the Squeak-dev