[Newbies] OrderedCollection if imageMorphs
cwdw01 at earthlink.net
Sat Nov 7 15:28:54 UTC 2009
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
im := SymbolBlank new.
self addMorph: im.
im topLeft: 2 at 2.
I want to enhance this so I can choose one of a collection of imageMorphs to
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.
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.
| sa si |
sa := SymbolArray new.
si := sa at: 1.
self addMorph: si.
si topLeft: 2 at 2.
I hope someone can help me figure out how to accomplish what I want to do.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Beginners