[squeak-dev] Weird Morphic layout problem

Sean P. DeNigris sean at clipperadams.com
Fri Jan 7 01:57:22 UTC 2011


I have MyMorph (TableLayout, h/v resizing: #shrinkWrap)
    with a submorph (TableLayout new, hResizing: #spaceFill, vResizing:
#shrinkWrap)
       whose submorphs are TextMorphs (hResizing: #spaceFill)

I can't get the TextMorphs laid out properly.  I want them to fill the
horizontal space of the owner morph, but be packed vertically together with
no space.  However, TextMorph's with lines that wrap overlap the text of the
TextMorph directly below them.

The weird thing is that everything gets laid out properly if I edit any of
the TextMorphs.  I tried calling #layoutChanged on various morphs with no
effect.

Thanks.
Sean

DoIt the following to see what I mean:
"aMorph := Morph new
	layoutPolicy: TableLayout new;
	layoutInset: 100;
	cellInset: 20;
	hResizing: #shrinkWrap;
	vResizing: #shrinkWrap;
	cellPositioning: #topLeft.
		
titleMorph := Morph new
	layoutPolicy: TableLayout new;
	hResizing: #spaceFill;
	cellPositioning: #topLeft.
	titleMorph addMorphBack: 'a line that the enclosing morph will shrink
around' asMorph.
	aMorph addMorphBack: titleMorph.
	
listMorph := Morph new
	color: Color green;
	layoutPolicy: TableLayout new;
	hResizing: #spaceFill;
	vResizing: #shrinkWrap;
	cellPositioning: #topLeft.
	aMorph addMorphBack: listMorph.

itemMorph := TextMorph new
	hResizing: #spaceFill;
	vResizing: #shrinkWrap;
	contents: 'a line that is so long that it wraps to the next line. there is
a lot of information here, so the line is long.';
	wrapFlag: true.
	listMorph addMorphBack: itemMorph.

item2Morph := TextMorph new
	hResizing: #spaceFill;
	vResizing: #shrinkWrap;
	contents: 'a short line that will get trampled';
	wrapFlag: true.
	listMorph addMorphBack: item2Morph.
	
aMorph openInWorld."

-- 
View this message in context: http://forum.world.st/Weird-Morphic-layout-problem-tp3178526p3178526.html
Sent from the Squeak - Dev mailing list archive at Nabble.com.



More information about the Squeak-dev mailing list