Sunday, June 6, 2010

Proportional layout

Here I show the proportional layout mechanisms of SystemWindow. This is based on the Layout section of the Pharo CollaborActive book written with the help of Hilaire Fernandes (more to come).

You will also learn to use Script Manager, an enhanced Workspace written by Joseph Pelrine.

I use Pharo 1.1-11357 beta.

Download screencast (800x600): .mpeg 24.4 MB, .mov 21.1 MB

Voice recorded by Christoph Budzinski.

The final code:

window := SystemWindow labelled: 'Layout'.

redMorph := Morph new.
 addMorph: redMorph
 fullFrame: (LayoutFrame 
  fractions: (0@0 corner: 1@1)
  offsets: (100@0 corner: 0@50 negated)).
redMorph color: Color red.

greenMorph := Morph new.
 addMorph: greenMorph
 fullFrame: (LayoutFrame 
  fractions: (0@0 corner: 0@1)
  offsets: (0@0 corner: 100@50 negated)).
greenMorph color: Color green.

yellowMorph := Morph new.
 addMorph: yellowMorph
 fullFrame: (LayoutFrame 
  fractions: (0@1 corner: 1@1)
  offsets: (0@50 negated corner: 0@0)).
yellowMorph color: Color yellow.

window openInWorld.