Centering elements in TableLayout

Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Centering elements in TableLayout

Esther
Hi,

I'm trying to do the following:

I have a morph for which I set TableLayout as layout Policy. List direction is topToBottom. Then I add some rectangular morphs with a centered string morph in each of them (serving as label). Most of the rectangular morphs are placed exactly one below the other, but some of them (which have a longer label) are placed out of the row.

This illustrates my problem: elements are not right below each other.

So I wonder how to get them all in a row with table layout. Everything I tried by now (listCentering- and cellPositioning-values) did not work for me. The only thing that a first seemed to work was listCentering: #justified, but then vertical spaces increase (for some reason I don't understand) when I scroll the field.

Can anyone give me a hint how to solve this problem?
Reply | Threaded
Open this post in threaded view
|

Re: [UI] Centering elements in TableLayout

Chris Muller-3
You might check your wrap setting, see that it's off.  I think
cellPositioning should be on the parent element, the container of the
others, and set to #center..

On Tue, Mar 16, 2010 at 9:18 AM, Esther <[hidden email]> wrote:

>
> Hi,
>
> I'm trying to do the following:
>
> I have a morph for which I set TableLayout as layout Policy. List direction
> is topToBottom. Then I add some rectangular morphs with a centered string
> morph in each of them (serving as label). Most of the rectangular morphs are
> placed exactly one below the other, but some of them (which have a longer
> label) are placed out of the row.
>
> http://n4.nabble.com/file/n1594908/notInALine.jpg
>
> So I wonder how to get them all in a row with table layout. Everything I
> tried by now (listCentering- and cellPositioning-values) did not work for
> me. The only thing that a first seemed to work was listCentering:
> #justified, but then vertical spaces increase (for some reason I don't
> understand) when I scroll the field.
>
> Can anyone give me a hint how to solve this problem?
> --
> View this message in context: http://n4.nabble.com/Centering-elements-in-TableLayout-tp1594908p1594908.html
> Sent from the Squeak - UI mailing list archive at Nabble.com.
> _______________________________________________
> UI mailing list
> [hidden email]
> http://lists.squeakfoundation.org/mailman/listinfo/ui
>
_______________________________________________
UI mailing list
[hidden email]
http://lists.squeakfoundation.org/mailman/listinfo/ui
Reply | Threaded
Open this post in threaded view
|

Re: [UI] Centering elements in TableLayout

Esther
Tuesday, March 16, 2010, 4:00:33 PM, you wrote:

> You might check your wrap setting, see that it's off.  I think
> cellPositioning should be on the parent element, the container of the
> others, and set to #center..

Thanks for your quick answer.

Which wrap setting do you mean?

#wrapDirection is set to none, #wrapDirection is by default set to
#topLeft.
I already tried to set cellPositioning: #center for the container, but
unfortunately it doesn't work.

It seems as if the following combination works:

vResizing: #shrinkWrap;
listCentering: #justified;
wrapCentering: #center.

#shrinkWrap avoids the spaces from getting bigger while scrolling,
listCentering: #justified puts the inner elements below each other and
wrapCentering: #center puts everything to the center.

But I don't really understand how this works and why listCentering:
#center is not the right option...Morphics and LayoutPolicies seem to
be some kind of dark magic.

Greetings,
Esther