Spec - Columns Containing Rows Containing Columns

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

Spec - Columns Containing Rows Containing Columns

Adventurer
Hi,

Spec has me tearing my hair out again.

I'm using a composed layout with two columns in it.  In the second column I'd like to place some rows which in turn contain columns.

There does not seem to be any way to do this.  Everthing that I try only renders one of the two main columns.
Guidance would be spreciated.

defaultSpec
    <spec: #default>
   
    ^SpecLayout composed
        newColumn: [ :tcol |
               tcol newRow:[:trow | trow add: #lblFolder     ] height: 30.
                ];
           
        newColumn: [ :tcol |
                tcol newRow:[:trow |
                    trow     newColumn: [ :tcol2 | tcol2 add: #ddlfolder];
                             newColumn: [ :tcol2 | tcol2 add: #txtFolder].
                            ] height: 30.
                ].

Reply | Threaded
Open this post in threaded view
|

Re: Spec - Columns Containing Rows Containing Columns

Nicolai Hess


2015-05-19 14:34 GMT+02:00 Craig Johnson <[hidden email]>:
Hi,

Spec has me tearing my hair out again.

I'm using a composed layout with two columns in it.  In the second column I'd like to place some rows which in turn contain columns.

There does not seem to be any way to do this.  Everthing that I try only renders one of the two main columns.
Guidance would be spreciated.


I don't know for sure, but I had a similar issue and solved it by using a single toplevel container
(only one call newRow/newColumn after "SpecLayout composed")

^ SpecLayout composed
newRow:[ :top |

top
        newColumn: [ :tcol |
               tcol newRow:[:trow | trow add: #lblFolder     ] height: 30.
                ];
           
        newColumn: [ :tcol |
                tcol newRow:[:trow |
                    trow     newColumn: [ :tcol2 | tcol2 add: #ddlfolder];
                             newColumn: [ :tcol2 | tcol2 add: #txtFolder].
                            ] height: 30.
                ].

]

 

defaultSpec
    <spec: #default>
   
    ^SpecLayout composed
        newColumn: [ :tcol |
               tcol newRow:[:trow | trow add: #lblFolder     ] height: 30.
                ];
           
        newColumn: [ :tcol |
                tcol newRow:[:trow |
                    trow     newColumn: [ :tcol2 | tcol2 add: #ddlfolder];
                             newColumn: [ :tcol2 | tcol2 add: #txtFolder].
                            ] height: 30.
                ].


Reply | Threaded
Open this post in threaded view
|

Re: Spec - Columns Containing Rows Containing Columns

Peter Uhnak
Indeed using a single top level container should be the best approach, because "SpecLayout composed" doesn't have any layout - so adding multiple items into it are just placed one over the other.
Arguably it might be better to add new methods "SpecLayout rows/SpecLayout cols" or something like that so you have the base layout defined.

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
view := DynamicComposableModel new.
models := #(
leftCol LabelModel
t11 LabelModel t12 LabelModel t13 LabelModel
t21 LabelModel t22 LabelModel t23 LabelModel
).
view instantiateModels: models.
models pairsDo: [ :lbl :m |
(view perform: lbl asSymbol) label: lbl.
].

layout := SpecLayout composed
newRow: [ :r |
r newColumn: [ :col | col add: #leftCol ].
r newColumn: [ :col |
col
newRow: [ :row |
row
add: #t11;
add: #t12;
add: #t13
];
newRow: [ :row |
row
add: #t21;
add: #t22;
add: #t23
]
]
];
yourself.
view openWithSpecLayout: layout.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Peter



On Tue, May 19, 2015 at 3:04 PM, Nicolai Hess <[hidden email]> wrote:


2015-05-19 14:34 GMT+02:00 Craig Johnson <[hidden email]>:
Hi,

Spec has me tearing my hair out again.

I'm using a composed layout with two columns in it.  In the second column I'd like to place some rows which in turn contain columns.

There does not seem to be any way to do this.  Everthing that I try only renders one of the two main columns.
Guidance would be spreciated.


I don't know for sure, but I had a similar issue and solved it by using a single toplevel container
(only one call newRow/newColumn after "SpecLayout composed")

^ SpecLayout composed
newRow:[ :top |

top
        newColumn: [ :tcol |
               tcol newRow:[:trow | trow add: #lblFolder     ] height: 30.
                ];
           
        newColumn: [ :tcol |
                tcol newRow:[:trow |
                    trow     newColumn: [ :tcol2 | tcol2 add: #ddlfolder];
                             newColumn: [ :tcol2 | tcol2 add: #txtFolder].
                            ] height: 30.
                ].

]

 

defaultSpec
    <spec: #default>
   
    ^SpecLayout composed
        newColumn: [ :tcol |
               tcol newRow:[:trow | trow add: #lblFolder     ] height: 30.
                ];
           
        newColumn: [ :tcol |
                tcol newRow:[:trow |
                    trow     newColumn: [ :tcol2 | tcol2 add: #ddlfolder];
                             newColumn: [ :tcol2 | tcol2 add: #txtFolder].
                            ] height: 30.
                ].



Reply | Threaded
Open this post in threaded view
|

Re: Spec - Columns Containing Rows Containing Columns

Nicolai Hess
I just saw there is are
SpecColumnLayout
SpecRowLayout

classes. So you can use


defaultSpec
    <spec: #default>
   
    ^SpecRowLayout composed
        newColumn: [ :tcol |
               tcol newRow:[:trow | trow add: #lblFolder     ] height: 30.
                ];
           
        newColumn: [ :tcol |
                tcol newRow:[:trow |
                    trow     newColumn: [ :tcol2 | tcol2 add: #ddlfolder];
                             newColumn: [ :tcol2 | tcol2 add: #txtFolder].
                            ] height: 30.
                ].



2015-05-19 19:35 GMT+02:00 Peter Uhnák <[hidden email]>:
Indeed using a single top level container should be the best approach, because "SpecLayout composed" doesn't have any layout - so adding multiple items into it are just placed one over the other.
Arguably it might be better to add new methods "SpecLayout rows/SpecLayout cols" or something like that so you have the base layout defined.

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
view := DynamicComposableModel new.
models := #(
leftCol LabelModel
t11 LabelModel t12 LabelModel t13 LabelModel
t21 LabelModel t22 LabelModel t23 LabelModel
).
view instantiateModels: models.
models pairsDo: [ :lbl :m |
(view perform: lbl asSymbol) label: lbl.
].

layout := SpecLayout composed
newRow: [ :r |
r newColumn: [ :col | col add: #leftCol ].
r newColumn: [ :col |
col
newRow: [ :row |
row
add: #t11;
add: #t12;
add: #t13
];
newRow: [ :row |
row
add: #t21;
add: #t22;
add: #t23
]
]
];
yourself.
view openWithSpecLayout: layout.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Peter



On Tue, May 19, 2015 at 3:04 PM, Nicolai Hess <[hidden email]> wrote:


2015-05-19 14:34 GMT+02:00 Craig Johnson <[hidden email]>:
Hi,

Spec has me tearing my hair out again.

I'm using a composed layout with two columns in it.  In the second column I'd like to place some rows which in turn contain columns.

There does not seem to be any way to do this.  Everthing that I try only renders one of the two main columns.
Guidance would be spreciated.


I don't know for sure, but I had a similar issue and solved it by using a single toplevel container
(only one call newRow/newColumn after "SpecLayout composed")

^ SpecLayout composed
newRow:[ :top |

top
        newColumn: [ :tcol |
               tcol newRow:[:trow | trow add: #lblFolder     ] height: 30.
                ];
           
        newColumn: [ :tcol |
                tcol newRow:[:trow |
                    trow     newColumn: [ :tcol2 | tcol2 add: #ddlfolder];
                             newColumn: [ :tcol2 | tcol2 add: #txtFolder].
                            ] height: 30.
                ].

]

 

defaultSpec
    <spec: #default>
   
    ^SpecLayout composed
        newColumn: [ :tcol |
               tcol newRow:[:trow | trow add: #lblFolder     ] height: 30.
                ];
           
        newColumn: [ :tcol |
                tcol newRow:[:trow |
                    trow     newColumn: [ :tcol2 | tcol2 add: #ddlfolder];
                             newColumn: [ :tcol2 | tcol2 add: #txtFolder].
                            ] height: 30.
                ].




Reply | Threaded
Open this post in threaded view
|

Re: Spec - Columns Containing Rows Containing Columns

Adventurer
and... it works.

Thanks to all who replied.  Putting the two columns into a RowLayout worked.

Craig

On 2015/05/19 07:41 PM, Nicolai Hess wrote:
I just saw there is are
SpecColumnLayout
SpecRowLayout

classes. So you can use


defaultSpec
    <spec: #default>
   
    ^SpecRowLayout composed
        newColumn: [ :tcol |
               tcol newRow:[:trow | trow add: #lblFolder     ] height: 30.
                ];
           
        newColumn: [ :tcol |
                tcol newRow:[:trow |
                    trow     newColumn: [ :tcol2 | tcol2 add: #ddlfolder];
                             newColumn: [ :tcol2 | tcol2 add: #txtFolder].
                            ] height: 30.
                ].