Starting the clock...

Bob Arning arning at charm.net
Fri Aug 30 12:53:57 UTC 2002


On Fri, 30 Aug 2002 00:03:37 -0400 Alan Grimes <alangrimes at starpower.net> wrote:
>I think that all I need to do now to get morphic working in my AI window 
>  is to start the stepping clock... However the most obvious methods for 
>doing this are still in beta, as I discovered. =\
>
>
>Here is my init method:
>
>> initialize
>> 	"Try to make an space.
>> 	| ex 
>> 	ex _ 400 at 300
>> 	super initialize.
>> 	self image: (Form extent: ex depth: 8).
>> 	super extent: image extent
>> 	self isOpaque: true.
>> 
>> 	"Try to set up morphic"
>> 	AICanvas _ FormCanvas on: image.
>
>I am fairly certain it works to this point because sending a message to 
>change the fill color to AICanvas changes the color of the rectangle on 
>the screen. -- AFTER I CLICK ON IT!!!

As stated, yes. If you ask a morph to change its color (sending #color:, e.g.), the morph will notify the World (through it chain of owners) that it needs to be redrawn. If, however, you change the color of something else, like AICanvas, (which is an instance variable? a class variable?) then what you are missing is some way for the World to know about the change. So, what you probably want to do is to say

	MorphicWorld color: Color magenta.

and let #color: handle both the changing of the color AND the notification to the World that redrawing is needed.

>> 	AIWorldState _ WorldState new
>> 		canvas: AICanvas
>> 	MorphicWorld _ PasteUpMorph new
>> 		initForProject: AIWorldState;
>> 		extent: ex;
>> 		color: color;
>> 		startBackgroundProcess.
>
>I don't know what to do after this step or even if I am emotely on the 
>right track at this juncture. I have been comparing the structure of the 
>mini-morphic I am trying to set up to the project structure and have 
>found that they are identical. =\
>
>The only difference I have discovered is that the world morph of the 
>project is getting clock ticks from somewhere by some method while the 
>counters in the mini-morphic are stalled.

Your example isn't quite complete enough to replicate here. How did you actually get MorphicWorld to appear on the screen, e.g.? Do consider that Projects/Worlds are somewhat special things. Unless you really need what they offer, other, simpler, morphs will be easier to use.

>Again, this is in persuit of my goal of setting up a visable field for 
>the AI to play with.
>
>BTW: I realized that my Squeak v3 sources is not the curren Squeak V3 
>sources... A more useful file-name would be appreciated. =\

Wild guess - are you complaining the the source for the system is split between 2 files (.sources and .changes)?

Cheers,
Bob



More information about the Squeak-dev mailing list