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 lay out submorphs
Last updated at 4:51 pm UTC on 2 June 2018

Introduction

Every Morph now has the capability to layout it's submorphs.
Previously, only the AlignmentMorph could implement layout policies.

Each Morph can have its own LayoutPolicy: either a ProportionalLayout or a TableLayout (as of 2009 and later).

Please read the excellent dynamic essay project MorphLayoutArticle (2001?).

Citation from this article:
"Control Your Submorphs

by Ted Kaehler and Andreas Raab

Last Fall Andreas reworked how objects in Squeak display their "submorphs", the objects that are inside of them. Class AlignmentMorph was eliminated, but a vestigial class of that name remains, in order to be backward compatible. The goal is to control how the objects inside a display object line up, and to control their spacing on the display. This essay is a "quick reference card" for the properties that control layout and alignment."


So AlignmentMorph is still available because of compatibility reasons and some utility methods it implements.

You should also be able to make your own subclasses of LayoutPolicy.

You can find other layout methods under Morph->layout-properties. Also, play with a Morphs Layout Properties using the red halo menu.



Examples

Here is some code to lay out some morphs in the new system.

More examples are needed – add yours here!