SpecTableLayout & TableLayoutProperties

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

SpecTableLayout & TableLayoutProperties

Peter Uhnak
Hi,

it is my understanding that I should be able to change table layout properties with stuff like cellPositioning: / listCentering: / etc.

However nothing I do have any change.
Am I using it incorrectly, or is this not (properly) implemented?

example: (the cell content is placed in #topLeft despite specifying positioning and centering)

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|ui layout|
ui := DynamicComposableModel new.

ui instantiateModels: #(
cell11 LabelModel
cell12 LabelModel
cell21 LabelModel
cell22 LabelModel
).

ui cell11 label: '1-1'.
ui cell12 label: '1-2'.
ui cell21 label: '2-1'.
ui cell22 label: '2-2'.


layout := SpecTableLayout column
cellPositioning: #center;
listCentering: #bottomRight;
newRow: [ :r | r
add: #cell11;
add: #cell12 ];
newRow: [ :r | r
add: #cell21;
add: #cell22];
yourself.

ui openWithSpecLayout: layout.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Thanks,
Peter
Reply | Threaded
Open this post in threaded view
|

Re: SpecTableLayout & TableLayoutProperties

webwarrior
It looks like I replied to Peter Uhnák directly, so I copy my message here:

If you open halo menu on topmost [in hierarchy] PanelMorph in window, you can see that layout properties have been set properly.

By default hResizing and vResizing are set to #spaceFill in SpecTableLayout, so:
1. rows are the same width - therefore cellPositioning doesn't matter
2. rows are occupying the whole height - therefore listCentering doesn't matter

The following layout will allow to see effects of listCentering and cellPositioning (btw cellPositioning is #center by default):

layout := SpecTableLayout column
    cellPositioning: #center;
    listCentering: #bottomRight;
    newRow: [ :r | r
            vResizing: #shrinkWrap;
            width: 120;
            add: #cell11;
            add: #cell12    ];
    newRow: [ :r | r
            vResizing: #shrinkWrap;
            add: #cell21;
            add: #cell22];
    yourself.