this works
tr := Transcript open. 3 timesRepeat: [ tr show: 'hello'. tr cr. (Delay forSeconds: 1) wait. ]
this doesn't work.
y := 100. offset := 20. 3 timesRepeat: [ t := TextMorph new openInWorld. t contents: 'hi'. t position: 100@y. y := y + offset. (Delay forSeconds: 1) wait. ]
desired behavior is 1 sec. between each TextMorph posting. actual behavior is a 3 second or so delay, then simultaneous posting of 3 TextMorphs
what's the problem/misunderstanding? how should a 1 sec. delay between each TextMorph drawing be written? (tia)
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1
Mark Polishook wrote:
this works
tr := Transcript open. 3 timesRepeat: [ tr show: 'hello'. tr cr. (Delay forSeconds: 1) wait. ]
this doesn't work.
y := 100. offset := 20. 3 timesRepeat: [ t := TextMorph new openInWorld. t contents: 'hi'. t position: 100@y. y := y + offset. (Delay forSeconds: 1) wait. ]
desired behavior is 1 sec. between each TextMorph posting. actual behavior is a 3 second or so delay, then simultaneous posting of 3 TextMorphs
I think it should be quite safe to do ...
[ y := 100. offset := 20. 3 timesRepeat: [ t := TextMorph new openInWorld. t contents: 'hi'. t position: 100@y. y := y + offset. (Delay forSeconds: 1) wait. ] ] forkAt: 21
(some explanation I've deduced and didn't falsified with experiments but that doesn't mean it is (the whole) true)
It seems as if most of the morphs were unable to update the screen if the foreground process is blocked (as in your original code by Delay). This is quite logical. However, there are some morphs which break this rule (Transcript, progress-bar and maybe also others). They seem to update their UI immediatelly within foreground-process. But they are used so often that this is really convenient.
Stepping mechanism wouldn't be of much use to you here but this is usually the way how to bring parallelism in Morphic UI (if you need some morphs to move, resize etc in parallel with the others or in parallel with the foreground process). As it is done in BlobMorph:
ClockMorph step ClockMorph stepTime
what's the problem/misunderstanding? how should a 1 sec. delay between each TextMorph drawing be written? (tia)
Ragards - -- Matej Košík
thanks gary and maraj -
On Dec 27, 2005, at 3:04 AM, Matej Košík wrote:
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1
Mark Polishook wrote:
this works
tr := Transcript open. 3 timesRepeat: [ tr show: 'hello'. tr cr. (Delay forSeconds: 1) wait. ]
this doesn't work.
y := 100. offset := 20. 3 timesRepeat: [ t := TextMorph new openInWorld. t contents: 'hi'. t position: 100@y. y := y + offset. (Delay forSeconds: 1) wait. ]
desired behavior is 1 sec. between each TextMorph posting. actual behavior is a 3 second or so delay, then simultaneous posting of 3 TextMorphs
I think it should be quite safe to do ...
[ y := 100. offset := 20. 3 timesRepeat: [ t := TextMorph new openInWorld. t contents: 'hi'. t position: 100@y. y := y + offset. (Delay forSeconds: 1) wait. ] ] forkAt: 21
(some explanation I've deduced and didn't falsified with experiments but that doesn't mean it is (the whole) true)
It seems as if most of the morphs were unable to update the screen if the foreground process is blocked (as in your original code by Delay). This is quite logical. However, there are some morphs which break this rule (Transcript, progress-bar and maybe also others). They seem to update their UI immediatelly within foreground-process. But they are used so often that this is really convenient.
Stepping mechanism wouldn't be of much use to you here but this is usually the way how to bring parallelism in Morphic UI (if you need some morphs to move, resize etc in parallel with the others or in parallel with the foreground process). As it is done in BlobMorph:
ClockMorph step ClockMorph stepTime
what's the problem/misunderstanding? how should a 1 sec. delay between each TextMorph drawing be written? (tia)
Ragards
Matej Košík -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.1 (GNU/Linux)
iD8DBQFDsPWDj6wbCo2ZNGIRAolzAKDl5Ph0W/2HKMAkOeItjd+sNBq/bACfXAvR GbTOQRllV6sp9PcqafsTwiY= =VsCg -----END PGP SIGNATURE-----
Hi.
Transcript show: 'something' implicitly runs a world cycle to update the ui, though in a non-obvious manner!
Try the following:
y := 100. offset := 20. 3 timesRepeat: [ t := TextMorph new openInWorld. t contents: 'hi'. t position: 100@y. World doOneCycleNow. "update the ui" y := y + offset. (Delay forSeconds: 1) wait. ]
Hope this helps.
squeak-dev@lists.squeakfoundation.org