[Cuis-dev] How do I center a morph in a table cell?

H. Hirzel hannes.hirzel at gmail.com
Wed Feb 12 12:31:59 PST 2025


On 12/02/2025 9:48 pm, Mark Volkmann wrote:
> On Wed, Feb 12, 2025 at 1:44 PM H. Hirzel via Cuis-dev 
> <cuis-dev at lists.cuis.st> wrote:
>
>     Hello
>
>     I want a table cell extent to be defined in absolute values and the
>     content should be centered.
>
>     What I have so far is
>
>                  cellContentExtent := (5 to: 80) atRandom asPoint.
>                  cellContent := (ColoredBoxMorph new :: morphExtent:
>     cellContentExtent; color: Color random).
>
>                  tableCell := (LayoutMorph newRow :: morphExtent:
>     100 at 100;
>     color: Color blue).
>                  tableCell addMorph: cellContent layoutSpec: (LayoutSpec
>     fixedExtent: cellContentExtent).
>                  tableCell openInWorld
>
>     How do I tell the tableCell layoutMorph to center its content?
>
>
> Does it work to add this?
>
> tableCell axisEdgeWeight: 0.5.
>
Yes it works.

And

tableCell axisEdgeWeight: #center.

also :-)

Thank you Mark.

-- Hannes





> -- 
> R. Mark Volkmann
> Object Computing, Inc.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.cuis.st/mailman/archives/cuis-dev/attachments/20250212/93cfb8bc/attachment.htm>


More information about the Cuis-dev mailing list