links to this page:    
View this PageEdit this PageUploads to this PageHistory of this PageTop of the SwikiRecent ChangesSearch the SwikiHelp Guide
How do I find a morph by name?
Last updated at 12:39 pm UTC on 18 December 2017
Question: is there a general way to find a morph by name? I tried out something like

 World allMorphsDo: [:m| m knownName = 'Yabba' ifTrue: [ mymorph := m ]]

But this seems awfully complicated for such a basic thing.


Morphs understand the message 'subMorphNamed:' so for the above you could do

 myMorph := World subMorphNamed: 'Yabba'.

Note: #subMorphNamed: only checks direct submorphs. For a component in a composite submorph use

 #allMorphsDo: aBlock 

or a similar method.

See also
aMorph knownName