[BUG] Morphic layout advice sought

Bob Arning arning at charm.net
Tue Feb 5 00:23:10 UTC 2002


Craig,

Here is something that may do what you want. It
- uses a simple Morph rather than a LineMorph to get the dividing line you want since Line(Polygon)Morphs have some peculiar notions about resizing (they try to stay centered).
- uses ProportionalLayouts to obtain the desired spacing. It seems that the layout mechanism saw some conflicts in who was to control the size of things. This seems to handle it.
- in a current 3.3, LayoutFrame doesn't understand #fractions:, but does understand #fractions:offsets.

Cheers,
Bob

-----
Morph new
	color: Color green;
	extent: 300 @ 300;
	layoutPolicy: ProportionalLayout new;
	addMorph: (
		Morph new color: (Color blue alpha: 0.5)
	)
	fullFrame: (
		LayoutFrame fractions: (0 at 1 corner: 1 @ 1) offsets: (0 at 100 negated corner: 0 at 0)
	);

	addMorph: (
		Morph new
			color: (Color red alpha: 0.5);
			layoutPolicy: ProportionalLayout new;
			addMorph: (
				Morph new 
					color: (Color yellow alpha: 0.5);
					layoutPolicy: TableLayout new;
					listDirection: #topToBottom;
					listCentering: #center;
					addMorph: (
						Morph new extent: 100 at 2; color: Color black; hResizing: #spaceFill
					)
			)
			fullFrame: (LayoutFrame fractions: (0 at 0 corner: 0.9 @ 0.9) offsets: nil)
	)
	fullFrame: (
		LayoutFrame fractions: (0 at 0 corner: 1 @ 1) offsets: (0 at 0 corner: 0 at 100 negated)
	);

	openInWorld
-----
On Mon, 04 Feb 2002 14:29:56 -0800 Craig Latta <Craig.Latta at NetJam.ORG> wrote:
>	I may be experiencing bugs with Morphic layout, or I might just be
>composing things incorrectly. I've read the active tutorial that Ted and
>Andreas wrote. I'd appreciate any advice...
>
>	Below is a simplified example of something I'm trying to do, nesting a
>proportional layout in a table layout. When I evaluate the expression,
>the resulting composite morph has a line which doesn't span its parent
>morph, despite its space-filling horizontal resizing directive. When I
>then resize the composite morph, it gradually corrects the layout, over
>the course of several mouse motion events. :)  After that, the layout
>sometimes becomes incorrect during resizing, depending on how fast I
>move the mouse! Try it and see how the colored morphs sometimes don't
>line up correctly.
>
>	Eventually I'd like to compose a morph with a scrollbar below, and a
>painting canvas with a drawing of some axes overlaid above.




More information about the Squeak-dev mailing list