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:
step
self changed
stepTime
^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?
Lou
displayDateTimeHeader "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@0 extent: fWidth@headerHeight. canvas frameAndFillRectangle: rect fillColor: self cellColor borderWidth: 2 borderColor: self borderColor. 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 textColor.
timeString := String streamContents: [:aStream | currentDate asTime print24: false showSeconds: true on: aStream]. self drawString: timeString centeredIn: rect vOffset: 65 withFont: font color: self textColor.