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

Jon Hylands jon at huv.com
Tue Dec 28 13:30:39 UTC 2004


On Mon, 27 Dec 2004 19:59:18 -0500, Jim Rosenberg <jr at amanue.com> wrote:

> Well, I just tried this, and am still not seeing the color change.

You need to do the following:

	aMorph
		changeBorderColor;
		changed.
	Display forceDisplayUpdate.
	100 timesRepeat: [
		(Delay forMilliseconds: 20) wait.
		aMorph world doOneCycle].
	aMorph
		restoreBorderColor;
		changed.
	"The following line is optional, and probably not needed."
	Display forceDisplayUpdate.

To force the morph to redraw, you need to send #changed to it. After that,
you need to force the redraw to the display. The delay as implemented above
is just a simpler way of keeping the UI running while you're pausing.

Later,
Jon

--------------------------------------------------------------
   Jon Hylands      Jon at huv.com      http://www.huv.com/jon

  Project: Micro Seeker (Micro Autonomous Underwater Vehicle)
           http://www.huv.com



More information about the Squeak-dev mailing list