[Newbies] OrderedCollection if imageMorphs

Alex Schenkman alex at schenkman.info
Sun Nov 8 08:58:53 UTC 2009


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 at 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 at 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 at 2.
>
>
>
> I hope someone can help me figure out how to accomplish what I want to do.
>
>
>
> _______________________________________________
> Beginners mailing list
> Beginners at lists.squeakfoundation.org
> http://lists.squeakfoundation.org/mailman/listinfo/beginners
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.squeakfoundation.org/pipermail/beginners/attachments/20091108/c75ea858/attachment.htm


More information about the Beginners mailing list