SBECell

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

SBECell

john mcelhose
I'm trying to do the Qunito exercis on p. 35 of 'Squeak by Example'. The screen is
 
System Browser: SBECell
SBE-Quinto                                     SBECell                                   --all--                             messageSelectorand ArgumentNames
                                                                                             as yet unclassified
messageSelectorAndArgumentNames
 "create quinto game"
 
 | initialize |
 initialize
     super initialize.
     self label:''.
     self borderWidth: 2.
     bounds:= [hidden email] corner: [hidden email].
     offColor := Color paleYellow.
     onColor := Color paleBlue darker.
     self useSquareCorners.
     self turnOf
I can inspect it, but if I do the 'openInWorld', Squeak objects that it doesn't know Initialize, or 'openInWorld' The lower screen in inspection shows
|openInWorld|
Nothing more expected.
How do I get it to open?

_______________________________________________
Beginners mailing list
[hidden email]
http://lists.squeakfoundation.org/mailman/listinfo/beginners
Reply | Threaded
Open this post in threaded view
|

Re: SBECell

Sean P. DeNigris
Administrator
john mcelhose wrote
messageSelectorAndArgumentNames
 "create quinto game"
 
 | initialize |
 initialize
     super initialize.
     self label:''.
     self borderWidth: 2.
     bounds:= 0@0 corner: 16@16.
     offColor := Color paleYellow.
     onColor := Color paleBlue darker.
     self useSquareCorners.
     self turnOf
It looks like you kept the "messageSelectorAndArgumentNames" part of the template.  So what you have now is:
* a method called messageSelectorAndArgumentNames
* which uses a temporary variable "initialize" (when you wrote "initialize" on a line by itself, Squeak thought it was an undeclared temporary variable (which is why it added the declaration | initialize |)

You should have:
initialize
     "create quinto game"
 
     super initialize.
     self label:''.
     ...

i.e. "messageSelectorAndArgumentNames" and the rest of the template gets replaced with your code
n.b. "self turnOf" should be "self turnOff"

john mcelhose wrote
I can inspect it, but if I do the 'openInWorld', Squeak objects that it doesn't know Initialize, or 'openInWorld' The lower screen in inspection shows
|openInWorld|
Nothing more expected.
How do I get it to open?    
A few things:
1. As someone pointed out before, methods are case-sensitive i.e. initialize, not Initialize
2. The more detailed and precise the better - when you say inspect "it," what is the it?  So that people can support you, clearly state the steps to reproduce what you're talking about.  The community is friendly and supportive, and if you put in the effort to ask a good question, this will be multiplied.
For example:
1. inspect from workspace: "SBECell new"
2. in inspector, doit: "self openInWorld"
3. error: "SBECell does not understand..."

Sean
Cheers,
Sean