How to update the appearance of a morph in mid-method?
htylim at yahoo.com.ar
Tue Dec 28 12:29:24 UTC 2004
Jim Rosenberg wrote:
> --On Monday, December 27, 2004 11:12 PM -0300 Hernan Tylim
> <htylim at yahoo.com.ar> wrote:
>> How are you trying to do the delay that you mentioned? With a "Delay
>> forDuration:" kind of call? If you are doing that it won't work because
>> that Delay will block the UI events processing.
> (Delay forSeconds: 2) wait.
> But this is *after* the color change. I'm hoping for something to
> update the display state before this happens.
Morphic doesn't inmediately draw changes on the display, rather it
caches all the ones produced in a cycle and process them at the end of
the loop. That is to avoid unnecessary draws.
In your code you are doing a color change, but then if you call Delay
you are blocking the UI events processing and the color will never get
changed. Moreover the whole UI will get unresponsive during the Delay.
Your code and the UI event loop is on the same thread, you shouldn't do
anything that blocks inside the morphic thread. If you want to do a
delay you need to do it as I show you on my previous mail. With the
#step methods, or doing the event loop yourself. This last one is done
in several places on the image to make modal dialogs, check senders of
More information about the Squeak-dev