Morphic question

Michael Bauers MichaelB at firstlogic.com
Thu Jul 13 16:05:22 UTC 2000


Well the more people keep talk, the more it sounds like the only way to
access a sub morph you created in a Morphic project window, and dropped on
its owner (PasteUpMoprh), is through some sort of iteration??

Or using that helper stuff some one else posted?

I understand how to do it if I am instantiating my own Morphs, that is
straightforward.  But it seems as if it is not so easy if I build up Morphs
using the Morphic project.

Wow, I thought it would be easier than all that.

confused in WI :)

> -----Original Message-----
> From:	Ned Konz [SMTP:ned at bike-nomad.com]
> Sent:	Thursday, July 13, 2000 10:27 AM
> To:	squeak at cs.uiuc.edu
> Subject:	Re: Morphic question
> 
> another piece of the puzzle:
> 
> Morphs have owners. If you drop a TextMorph on a PasteUpMorph, the
> PasteUpMorph becomes the owner of the TextMorph.
> 
> If the one morph that owns all the sub-morphs (in this case the
> PasteUpMorph) has accessors for the sub-morphs (perhaps because it's
> constructed them and knows who they are), then sub-morphs can use
> those accessors:
> 
> You might have your own subclass of a PasteUpMorph that constructs
> submorphs and hangs on to them in instance variables.
> 
> For instance, it might have code like:
> 
> 	textMorph := TextMorph new contentsAsIs: 'whatever'.
> 
> and an accessor:
> 
> 	textMorph
> 		^textMorph
> 
> then a button could access that morph using:
> 
> 	owner textMorph
> 
> Even if the owner doesn't know about its submorphs by name, you
> can iterate through them (but don't do this, because it's ugly
> and violates all kinds of OO principles):
> 
> 	owner submorphThat: [ :each | each isKindOf: TextMorph ] ifNone: [].
> 
> (see also submorphWithProperty: if you want to tag submorphs)
>  
> -- 
> Ned Konz
> currently: Stanwood, WA
> email:     ned at bike-nomad.com
> homepage:  http://bike-nomad.com





More information about the Squeak-dev mailing list