[squeak-dev] Re: TextMorph takes to much space in layout
r2ruyu-nana at yahoo.de
r2ruyu-nana at yahoo.de
Sun Aug 14 17:56:12 UTC 2011
Thank you for your answer!
You addressed the layoutChanged problem, but isn't there a way to make
TextMorph behave like an ordinary Morph concerning hResizing:#spaceFill? I
don't want a fixed width.
In case there is no such way, what would be a nice method to encapsulate the
layoutChanged call? I've a complex morph with many submorphs arranged, and now
I would need to 'openInWorld' that big widget and get a reference to all
TextMorphs to call layoutChanged for them in order to adapt the parent
widgets...that's not nice :(
Another possible, but ugly solution which came into my mind: calling
aTextMorph #contents:#wrappedTo: in the step method of the TextMorph (or my
subclass of it) using the width of the parent (if parent is not nil).
Sincerely,
r2ruyu
On Sunday 14 August 2011 13:59:05 Sean P. DeNigris wrote:
> r2ruyu-nana wrote:
> > How to get it right from the beginning on? Without doing explicitly 'w
> > layoutChanged'.
>
> Welcome! And welcome to the esoteric arts of Morphic layout. I find this to
> be by far the most mind-boggling area of the image. You actually got away
> easy with the layoutChanged trick.
>
> r2ruyu-nana wrote:
> > "width: 300;"
> > backgroundColor: Color veryLightGray;
> > hResizing: #spaceFill.
>
> The last line is your problem. You're specifically telling the TextMorph to
> fill the horizontal space. However, if you change it to #rigid, you will
> not be any happier because the text will be all scrunched up vertically.
> However, if you pair #rigid with #contents: instead of contentsWrapped:
>
> TextMorph new contents: 'Some very very very very long string...'.
>
> you will have the same size as after layoutChanged without the explicit
> width: setting.
>
> HTH,
> Sean
>
> --
> View this message in context:
> http://forum.world.st/TextMorph-takes-to-much-space-in-layout-tp3741528p37
> 42760.html Sent from the Squeak - Dev mailing list archive at Nabble.com.
More information about the Squeak-dev
mailing list
|