How to update the appearance of a morph in mid-method?

Hernan Tylim htylim at yahoo.com.ar
Tue Dec 28 02:12:41 UTC 2004


Hi Jim,

    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.

    The only way I know to make timed things on Morphic is with the 
stepping mechanism. If you don't  know how it works just check the 
following methods on your image: #step, #stepTime, #startStepping and 
#stopStepping. Take into account that with #step you wont be able to do 
the flashing effect in only one method as you were describing. But that 
is because Morphic wasn't intended to be used in that way.

    If you don't want to use the stepping mechanism then you will be 
doomed to do the UI events processing yourself. Instead of using Delay 
you should  make a while loop with something like this:

    [done] whileFalse: [
       self world ifNotNil: [self outermostWorldMorph doOneCycle].
       "check the elapsed time and set done accordingly"
    ]

    Hope it helps.

Regards,
Hernán

 
Jim Rosenberg wrote:

> --On Monday, December 27, 2004 7:51 PM -0500 Jon Hylands <jon at huv.com> 
> wrote:
>
>>> There has to be a simple way to do this. How do you tell a morph to 
>>> show
>>> itself "right now" in its current condition -- in mid-method?
>>
>>
>> I think you can do:
>>
>> Display forceDisplayUpdate.
>
>
> Well, I just tried this, and am still not seeing the color change.
>
> ---
> Jim Rosenberg                      http://www.well.com/user/jer/
>     WELL: jer
>     Internet: jr at amanue.com
>
>
>




More information about the Squeak-dev mailing list