Q: Updating TextMorph when embedded morph change size?

Hannes Hirzel hirzel at spw.unizh.ch
Sat Mar 9 21:37:58 UTC 2002


On Sat, 9 Mar 2002, Karl Ramberg wrote:

> I'm doing some layout stuff and need to update the paragraph
> because the size of embedded submorphs change. Anybody got a tip
> on how to make the TextMorph do this automagically ?
> 
> Karl
> 
> 

I updated the bullet list morph I posted recently. It is on
http://minnow.cc.gatech.edu/squeak/2141

Resizing with the yellow halo works now the way I like it to have.


The crucial point for the TextMorph is to do the following:

t := TextMorph new.
t layoutPolicy: TableLayout new.
t hResizing: #spaceFill.  "I want the text to expand to the whole
                           width of the enclosing Morph"
t vResizing: #shrinkWrap. "I do want to have the text enclosed as tight as
                           possible in the vertical direction"


However some trial and error was necessary and I had to add
as the two last lines

item1 layoutChanged.
item2 layoutChanged.

just after I open the enclosing RectangleMorph. 


It would be great if a Morphic specialist could look into this and 
give some advice how to streamline the code.


To summarize: The short answer is to send 
layoutChanged to either the TextMorph or the enclosing Morph and to
have set up the properties of the TextMorph in the correct way, of
which I'm not yet sure what would be the canonical form.

Please keep me updated if you find out something additional.

Cheers
Hannes Hirzel




More information about the Squeak-dev mailing list