Help requested with morphic-related bug

David T. Lewis lewis at mail.msen.com
Sun Jan 1 18:58:45 UTC 2006


On Sat, Dec 31, 2005 at 09:49:53PM +0100, karl wrote:
> Kurt Thams wrote:
> 
> > karl wrote:
> >
> >> Kurt Thams wrote:
> >>
> >>> I wrote a program to solve Sudoku puzzles, and when I run it I get a 
> >>> problem... various submorphs stop drawing (and get rendered as a red 
> >>> box with a yellow cross through it), and a walkback comes up with 
> >>> "Error: Error: Instances of UndefinedObject are not indexable" (in 
> >>> WorldState>>displayWorldSafely)
> >>>
> >>> Not sure if I'm doing something wrong with my program or if it is an 
> >>> error in Morphic.
> >>>
> >>> Essentially, I fork a process and set a morph to step while the 
> >>> forked process updates the model that the morph is drawing from.
> >>>
> >> Don't fork off a process. Morphic runs in a single thread and a you 
> >> will get errors like this if you
> >> try using other processes. Use morphics step mechanism or if you 
> >> _really_ have to use a seperate process
> >> use WorldState>>addDeferredUIMessage:
> >> Karl
> >>
> >>
> > So how do you properly use Morphic to display the intermediate results 
> > of a long-running, computationally-intensive process? This code could 
> > not be runing in the step method, otherwise the display would never 
> > update.

Do this:

WorldState addDeferredUIMessage: ["display your intermediate results"]

It's perfectly OK to run background processes as you describe. All
you need to do is schedule the display parts to run in the Morphic
UI process using #addDeferredUIMessage:.

Dave




More information about the Squeak-dev mailing list