Curious behavior

Ned Konz ned at bike-nomad.com
Mon Jan 13 04:27:47 UTC 2003


On Sunday 12 January 2003 07:01 pm, Bill Spight wrote:
> All:
>
> When I try to create a new GoMorph, I get some strange behavior
> from Squeak (latest download for WindowsME).
>
> Here is the #initialize method:
>
> GoMorph>>initialize
>     super initialize.
>     self boardExtent = nil
>  	ifTrue: [boardExtent _ 19 @ 19].
>     self winner: #NoOne;
>
> 	board: ((Array new: self height * self width)
> 		atAllPut: (Dictionary new at: #Color put: #Empty;
> 			 at: #Liberties put: Set new;
> 			 yourself));
>         lastPlayer: #NoOne;
> 	addMorph: (boardMorph _ GoBoardMorph newBoardExtent: self
> boardExtent). self boardHandler: GoStoneHandler new
>
> Everything goes fine until the last line. It is a bit unusual
> because it actually sets an instance variable of a submorph. Here
> is that method:
>
> GoMorph>>boardHandler: aMorph
>     "The boardHandler is actually an instance variable of the
> submorph, boardMorph."
>     boardMorph handler: aMorph
>
> The problem comes, though, before this method is called. Instead of
> sending the #new message to GoStoneHandler (which has no class
> methods of its own, and is a subclass of EllipseMorph)

That sounds a bit peculiar. I usually think of things called Handlers 
as being non-GUI elements (i.e. models). But I don't know your 
design.

> Squeak sends
> it to UndefinedObject. Which does not work, OC.

Do you have a GoMorph class variable or pool variable (or did you 
ever) with the name GoStoneHandler?

You might add a line in that method:

GoStoneHandler inspect.

and make sure it's not nil.

> If I comment out the last line and Do the following, which I think
> should be equivalent, everything works as intended.
>
> gofer _ GoMorph new.
> gofer boardHandler: GoStoneHandler new

-- 
Ned Konz
http://bike-nomad.com
GPG key ID: BEEA7EFE




More information about the Squeak-dev mailing list