That worked!!! Thanks - I never would have figure it out on my own.
I'm so confused though. I've never had to explicitly call an initialize method before - they seem to be invoked automatically when I use the word "new". Should I always call the initialize when I create a new instance?
@Herbert - I'm making a pinball machine in which the little ball follows the order of execution of a student entered flowchart.at least that's what I'm trying to do ;-)
From: beginners-bounces@lists.squeakfoundation.org [mailto:beginners-bounces@lists.squeakfoundation.org] On Behalf Of Alex Schenkman Sent: Sunday, November 08, 2009 3:59 AM To: A friendly place to get answers to even the most basic questions about Squeak. Subject: Re: [Newbies] OrderedCollection if imageMorphs
I think you might need to call SymbolArray>>intialize by your self.
If you look at the chain of message sends starting from 'SymbolArray new'
1) OrderedCollection new
2) OrderedCollection new:
3) Behavior basicNew
There is no call to initialize.
On Sat, Nov 7, 2009 at 16:28, Christine Wolfe cwdw01@earthlink.net wrote:
I want to put add an imageMorph on top of another imageMorph.
I can do this with the following method (note SymbolBlank is an imageMorph
MyBoard>>addSymbol
|im|
im := SymbolBlank new.
self addMorph: im.
im topLeft: 2@2.
I want to enhance this so I can choose one of a collection of imageMorphs to add.
I created a class, SymbolArray, that is a subclass of OrderedCollection with the following initialize method. Each of the items I'm adding (SymbolBlank, SymbolGet, etc) is an imageMorph.
SymbolArray>>initialize
super initialize.
self add: SymbolBlank new.
self add: SymbolGet new.
self add: SymbolProcess new.
self add: SymbolPut new.
self add: SymbolIf new.
self add: SymbolWhile new.
Then I tried to modify the addSymbol method as show below.
When I do, I get the following error message which sounds like I don't have an element at index 1.
SymbolArray(OrderedCollection)>>errorNoSuchElement
SymbolArray(OrderedCollection)>>at:
| sa si |
sa := SymbolArray new.
si := sa at: 1.
self addMorph: si.
si topLeft: 2@2.
I hope someone can help me figure out how to accomplish what I want to do.
_______________________________________________ Beginners mailing list Beginners@lists.squeakfoundation.org http://lists.squeakfoundation.org/mailman/listinfo/beginners