Add the class:
StringMorph subclass: #Horloge
 instanceVariableNames: ''
 classVariableNames: ''
 poolDictionaries: ''
 category: 'Sandbox'
One method called periodically thanks to stepping mechanism of Morphic:
Horloge>>step
 self contents: Time now printString.
Then evaluate in a Workspace:
Horloge new openInWorld.
Stop the watch:
Horloge allInstances last stopStepping
Start it again:
Horloge allInstances last startStepping
Finally close it:
Horloge allInstances last delete
謝謝,很棒的小範例
ReplyDelete