[Pharo-dev] Proportional Layout does not work for me

Thierry Goubier thierry.goubier at gmail.com
Sat Apr 9 14:28:09 EDT 2016


Hi,

you're falling prey to the Rectangle / LayoutFrame api issue: your 
offsets, when written this way, are reversed.

You need to use a different API: for example:

frame := (0 @ 0 corner: 1.0 @ 1.0) asLayoutFrame topLeftOffset: 0 @ 50; 
bottomRightOffset: 0 at 50 negated.

Thierry

Le 09/04/2016 19:44, kmo a écrit :
> I was just experimenting with creating a user interface in Pharo using
> Morphic. I wanted to create a sub-morph that fills its parent with a 50
> pixel gap at the top and a 50 pixel gap at the bottom (leaving space for a
> toolbar at the top and a status bar at the bottom).
>
> This code works in pharo 3 but does not work in pharo 4 or 5:
>
> Morph>>>initialize
> |frame sub|
> 	super initialize.
> 	self layoutPolicy: ProportionalLayout new.
> 	frame := LayoutFrame fractions: (0.0 @ 0.0 corner: 1.0@ 1.0) offsets: (0 at 50
> corner: 0 at 50 negated).
> 	sub := BorderedMorph new.
> 	sub color: Color red.
> 	self addMorph: sub fullFrame: frame.
> 	self extent:600 at 600.
>
> Am I doing something wrong or is proportional layout broken?
>
>
>
> --
> View this message in context: http://forum.world.st/Proportional-Layout-does-not-work-for-me-tp4889237.html
> Sent from the Pharo Smalltalk Developers mailing list archive at Nabble.com.
>
>




More information about the Pharo-dev mailing list