Squeak
  links to this page:    
View this PageEdit this PageUploads to this PageHistory of this PageTop of the SwikiRecent ChangesSearch the SwikiHelp Guide
How to apply some code to all submorphs of a Morph
Last updated at 5:12 pm UTC on 23 February 2017
Morphs form a composition hierarchy. You can access the submorphs of a Morph by sending it the message #submorphs.

With
 aMorph submorphsDo: [:each | each someMessage]

you can send someMessage to all direct submorphs.

However if you want to apply something to the whole composition hierarchy you have to use

 aMorph allMorphsDo: [:each | each someMessage]