Curious behavior
Bill Spight
bspight at pacbell.net
Mon Jan 13 03:01:55 UTC 2003
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) Squeak sends it to
UndefinedObject. Which does not work, OC.
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
Am I missing something?
Many thanks,
Bill Spight
More information about the Squeak-dev
mailing list
|