[Cuis-dev] TAble Layout

H. Hirzel hannes.hirzel at gmail.com
Thu Feb 13 02:34:46 PST 2025


Hi Hilaire

On 13/02/2025 8:51 am, Hilaire Fernandes wrote:
>
> It is likely not as feature complete as the Squeak TableMoprh but it 
> fills my need for now.
>
I actually prefer it this way. A solution which is less complex and easy 
to use. I think in Squeak a Squeak morph which uses a TableLayout 
LayoutPolicy is a misnomer.

It only acts as a table if you have submorphs of fixed width and pay 
attention how you add them in regards to the total width of the morph. 
In fact does a flow layout.


> Can be observed in action toward the end of this video 
> https://mamot.fr/@drgeo/113995472843136374
>
Amazing demo what is now possible in terms of editing/annotating in your 
Dynabook application.

I assume you use the FlowLayoutMorph in the flap you open at the end.


> May be FlowMorph will be a nice name, while FlowLayoutMoprh might be a 
> more precise name, I found it a bit too long.
>
There are many morph classes which have longer names.

If I search for a class and give as class name fragment 'Layout' it will 
appear in the choices together with LayoutAdjustingMorph, LayoutMorph 
and LayoutSpec.

So Layout related classes will be easily found. So I suggest to go for 
the name 'FlowLayoutMorph'.

I did an example which mimics table layout behavior as all the item 
morphs are of the same size

example1b
"
     self example1b
"
     | table cells |
     table := self new openInWorld.
     cells := OrderedCollection new.
     30 timesRepeat: [ |cellContent cellContentExtent cell  |
              cellContentExtent := (15 to: 80) atRandom asPoint.
              cellContent := (ColoredBoxMorph new ::
                     morphExtent: cellContentExtent; color: Color random).

              cell := (LayoutMorph newRow ::  morphExtent: 100 at 100;
                 color: Color lightGray; layoutSpec: LayoutSpec 
keepMorphExtent).
              cell addMorph: cellContent
                 layoutSpec: (LayoutSpec fixedExtent: cellContentExtent).
         cell axisEdgeWeight: #center.
         cells add: cell].

     table cells: cells


But I guess this is not what you meant when you wrote earlier in the thread

"Should be easy to add quite easily vertical alignment preferences."

But my suggestion is to keep this current morph as a FlowLayoutMorph as 
is and for a table with aligned columns go for another Layout morph type 
and call that TableLayoutMorph.

A TableLayoutMorph which lets you define the column widths.

Hannes


> Hilaire
>
> Le 12/02/2025 à 21:06, H. Hirzel a écrit :
>>
>> I think none of them. Above I wrote it is like the Squeak TableMorph 
>> LayoutManager which I maintain.
>>
>> I think it is rather like the Java FlowLayout
>>
>> https://docs.oracle.com/javase/tutorial/uiswing/layout/flow.html
>>
>> So maybe FlowLayoutMorph?
>>
>> --Hannes
>>
> -- 
> http://mamot.fr/@drgeo
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.cuis.st/mailman/archives/cuis-dev/attachments/20250213/1aa034d2/attachment-0001.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: CuisFlowLayoutMorph_example1b_with_fixed_size_cells.png
Type: image/png
Size: 29602 bytes
Desc: not available
URL: <http://lists.cuis.st/mailman/archives/cuis-dev/attachments/20250213/1aa034d2/attachment-0001.png>


More information about the Cuis-dev mailing list