[Q] How to make submorphs scale proportionately

Ned Konz ned at bike-nomad.com
Tue Mar 26 15:31:14 UTC 2002


On Tuesday 26 March 2002 07:05 am, Ned Konz wrote:
> On Tuesday 26 March 2002 02:44 am, Rudi Angela wrote:
> > I want to have my morph's submorphs scale proportionately when I resize
> > the parent morph. What do I need to do to achieve that?
>
> on the submorphs, get their halo menu, and do:
> layout/child layout/horizontal resizing/space fill
> same for vertical resizing
>
> Make the parent anything but shrinkwrap; having a shrinkwrap parent and
> space fill submorphs doesn't work very well.

The above will work when there is a single morph across, or up and down that 
you need to resize.

There is the proportional layout; this is mostly used by the SystemWindow 
derivatives. Look at ProportionalLayout, LayoutFrame (and SystemWindow, which 
uses these). For proportional layout to work, you must provide submorphs a 
layoutFrame that specifies the proportional layout.

There is also the table layout for the parent: you can have a Morph that will 
layout its submorphs into a row or column, with possible wrapping. You can 
use this, with the submorphs having shrinkwrap sizing, to do other layout.

Another possibility (if you don't mind writing some code) is to provide a 
layoutPolicy (which can be self, I think). The layoutPolicy is an object that 
can respond to #layout:in: and is called when the Morph needs to be laid out.

-- 
Ned Konz
currently: Stanwood, WA
email:     ned at bike-nomad.com
homepage:  http://bike-nomad.com



More information about the Squeak-dev mailing list