window := SystemWindow labelled: 'Layout'.
redMorph := Morph new.
window
addMorph: redMorph
fullFrame: (LayoutFrame
fractions: (0@0 corner: 1@1)
"in fractions: the numbers represent a value from 0 to 1
i.e. a decimal fraction, of 100% of the parent window's size"
offsets: (100@0 corner: 0@50 negated)).
"in offsets: the numerics represent absolute values, in pixels"
redMorph color: Color red.
"there is a set of named colors. Color objects can also be specified as RGB values
r:g:b: Each parameter is a number between 0 and 1.0 "
Two morphs side-by-side in a proportional layout will automagically have a grabbable, movable pane edge.
greenMorph := Morph new.
window
addMorph: greenMorph
fullFrame: (LayoutFrame
fractions: (0@0 corner: 0@1)
offsets: (0@0 corner: 100@50 negated)).
greenMorph color: Color green.
yellowMorph := Morph new.
window
addMorph: yellowMorph
fullFrame: (LayoutFrame
fractions: (0@1 corner: 1@1)
offsets: (0@50 negated corner: 0@0)).
yellowMorph color: Color yellow.
window openInWorld. "sent to the superclass"
No comments:
Post a Comment