[Newbies] OrderedCollection if imageMorphs
cwdw01 at earthlink.net
Mon Nov 9 17:10:37 UTC 2009
Thanks for the info. I have finished the IU and have it working fine in
PowerPoint ;-) animations. Now I want to move it to a real programming
language. The reason for the ordered collection is this. For each
position in the flowchart, there is a space on the pinball machine were the
user can click - with each click, the next symbol in the ordered collection
is displayed. When the user sees the symbol he wants in that position, he
will stop clicking and move on to the next position. (The spaces for the
flowcharting symbols is a matrix of these ordered collections.)
My original misunderstanding was in thinking that I should use
orderedcollection as an object (which I know it is) instead of thinking of
it as more of a datatype kind of thing..... This forum has been super helpful.
At 11:24 AM 11/9/2009, Bert Freudenberg wrote:
>On 09.11.2009, at 02:08, Christine Wolfe wrote:
>>Oh wow! thanks - having the sample code will be a huge help. I'll
>>give it a
>>From: Randal L. Schwartz [mailto:merlyn at stonehenge.com]
>>Sent: Sunday, November 08, 2009 8:03 PM
>>To: Christine Wolfe
>>Cc: beginners at lists.squeakfoundation.org
>>Subject: Re: [Newbies] OrderedCollection if imageMorphs
>>>>>>>"Christine" == Christine Wolfe <cwdw01 at earthlink.net> writes:
>>Christine> Oh, I'm so so sorry - I thought it was OK to ask dumb
>>Christine> the newbie forum (blush) I'll try to figure out how to
>>Christine> instance variable an order collection.
>>It's perfectly OK, and that's why you were corrected. :)
>>Basically, you'll do the following:
>>* add an instance variable: contents
>>on your instance side, add:
>> super initialize.
>> contents := OrderedCollection new.
>>then for each item of the collection protocol, delegate it, as in:
>> add: anItem
>> ^contents add: anItem.
>> includes: anItem
>> ^contents includes: anItem.
>> ^contents size.
>>and so on. If you get really tired of adding all of them,
>>just add them as you need them (when the debugger tells you :).
>Why would you want to add all these methods and your own class in the
>first place? They are there already, perfectly usable.
>>If you wanna get really tricky, you can add a #doesNotUnderstand:
>>perform the method on the contents variable, but that can mess up your
>>debugging, so it's better if you don't.
>Err, now that goes into the land of advanced applied magic. Please
>ignore that last paragraph ;)
>Christine, if you want an OrderedCollection of ImageMorphs (as you
>wrote in the subject) then do just that. Create an OrderedCollection,
>not a subclass of it. And add ImageMorphs, not subclasses of
>ImageMorphs (unless they indeed do specific processing - but even then
>I'd probably make only one ImageMorph subclass and customize that).
>It is often unnecessary to create your own classes for everything. For
>example, if the only difference of a regular ImageMorph and your own
>Morph subclass is the image it shows, then do not create a subclass.
>Just assign the right image. And maybe assign an event handler, no
>need for subclassing there either.
>OTOH, when I look at your high-level goal "I'm making a pinball
>machine in which the little ball follows the order of execution of a
>student entered flowchart" I don't really see the need for a
>"SymbolArray" nor even "OrderedCollection of ImageMorphs". Maybe you
>should design the UI first and then implement whatever is necessary to
>make it work?
>- Bert -
>Beginners mailing list
>Beginners at lists.squeakfoundation.org
More information about the Beginners