tree := TreeModel new.
tree openWithSpec.
tree columns: (Array
with: (MorphTreeColumn new rowMorphGetSelector: [:node | node item
first asString asMorph ]; headerButtonLabel: 'Name' font: nil; yourself)
with: (MorphTreeColumn new rowMorphGetSelector: [:node | node item
second asString asMorph ]; headerButtonLabel: 'Last Name' font: nil; yourself)
with: (MorphTreeColumn new rowMorphGetSelector: [:node | node item
third asString asMorph ]; headerButtonLabel: 'Age' font: nil; yourself)
with: (MorphTreeColumn new rowMorphGetSelector: [:node | node item
fourth asString asMorph ]; headerButtonLabel: 'Gender' font: nil; yourself)
with: (MorphTreeColumn new rowMorphGetSelector: [:node | (ButtonModel
new label: 'Yes we can') buildWithSpec hResizing: #spaceFill];
headerButtonLabel: 'Morph' font: nil; yourself)).
tree roots: {
{'Benjamin'.'Van Ryseghem'.'26'.'M'}.
{'Pamela'.'Anderson'.'Far too much'.'F'}
}
Ben
On 08 Nov 2013, at 14:05, prova email <[email protected]> wrote:
> Yes Ben, too much threads! That's why i'm a little bit confused! That's what
> i understood: i've got two roads-> use TreeModel as you did with Pamela
> Anderson or use the simple and nested SpecLayout (SpecLayout composed) as
> Clement did.
> If in your TreeModel i can put a RadioButtonModel or a ButtonModel or so
> on... we got the deal!
>
> Paolo
>
> From: [email protected]
> Date: Fri, 8 Nov 2013 13:59:51 +0100
> To: [email protected]
> Subject: Re: [Pharo-users] Spec - Grid/Table Layout
>
> I guess too much threads :)
>
> I answer this in another thread I think :P
>
> the block provided to displayBlock:/rowMorphGetSelector: can return anything
> understanding asMorph.
> So you can return any custom morph there :)
>
> I think the following work
>
> tree columns: (Array
> with: (TreeColumnModel new displayBlock: [:node | node content first
> asString ]; headerLabel: 'Name'; yourself)
> with: (TreeColumnModel new displayBlock: [:node | node content second
> asString ]; headerLabel: 'Last Name'; yourself)
> with: (TreeColumnModel new displayBlock: [:node | node content third
> asString ]; headerLabel: 'Age'; yourself)
> with: (TreeColumnModel new displayBlock: [:node | node content fourth
> asString ]; headerLabel: 'Gender'; yourself)
> with: (TreeColumnModel new displayBlock: [:node | Morph new ];
> headerLabel: ‘Morph'; yourself))
>
> or
>
> tree columns: (Array
> with: (MorphTreeColumn new rowMorphGetSelector: [:node | node item
> first asString asMorph ]; headerButtonLabel: 'Name' font: nil; yourself)
> with: (MorphTreeColumn new rowMorphGetSelector: [:node | node item
> second asString asMorph ]; headerButtonLabel: 'Last Name' font: nil; yourself)
> with: (MorphTreeColumn new rowMorphGetSelector: [:node | node item
> third asString asMorph ]; headerButtonLabel: 'Age' font: nil; yourself)
> with: (MorphTreeColumn new rowMorphGetSelector: [:node | node item
> fourth asString asMorph ]; headerButtonLabel: 'Gender' font: nil; yourself)
> with: (MorphTreeColumn new rowMorphGetSelector: [:node | Morph new ];
> headerButtonLabel: 'Morph' font: nil; yourself)).
>
> And you get something like
>
> <Screen Shot 2013-11-08 at 13.58.51.png>
>
> Ben
>
> On 08 Nov 2013, at 13:45, prova email <[email protected]> wrote:
>
> Yes Clement, i've got your .st file. I saw it in Nested Layout thread. I file
> in it in Pharo and i see that is not as good as a fashion window is. Maybe
> Morphic is the right solution but, in that way, we are leaving the idea of
> Bahman, and the 2nd Spec Tuto is in danger!
>
> However, you asked to Ben the same question that i did: can i put some
> widgets in these cells or only String?
>
> Thanks again!
> Paolo
>
> From: [email protected]
> Date: Fri, 8 Nov 2013 12:51:06 +0100
> To: [email protected]
> Subject: Re: [Pharo-users] Spec - Grid/Table Layout
>
> Ben answered in another thread:
>
> About table, I have an example which will be running soon in Pharo (the
> changes are waiting to be integrated)
>
> tree := TreeModel new.
> tree openWithSpec.
>
> tree columns: (Array
> with: (TreeColumnModel new displayBlock: [:node | node content first
> asString ]; headerLabel: 'Name'; yourself)
> with: (TreeColumnModel new displayBlock: [:node | node content second
> asString ]; headerLabel: 'Last Name'; yourself)
> with: (TreeColumnModel new displayBlock: [:node | node content third
> asString ]; headerLabel: 'Age'; yourself)
> with: (TreeColumnModel new displayBlock: [:node | node content fourth
> asString ]; headerLabel: 'Gender'; yourself)).
>
> tree roots: {
> {'Benjamin'.'Van Ryseghem'.'26'.'M'}.
> {'Pamela'.'Anderson'.'Far too much'.'F'}
> }
>
>
> Right now, you can get the same by
> - adding MorphTreeAdapter>>#columns:
> columns: columns
> self widgetDo: [ :w |
> w columns: columns.
> w resizerChanged.
> w updateList ]
>
> And then evaluating:
>
> tree := TreeModel new.
> tree openWithSpec.
>
> tree columns: (Array
> with: (MorphTreeColumn new rowMorphGetSelector: [:node | node item
> first asString asMorph ]; headerButtonLabel: 'Name' font: nil; yourself)
> with: (MorphTreeColumn new rowMorphGetSelector: [:node | node item
> second asString asMorph ]; headerButtonLabel: 'Last Name' font: nil; yourself)
> with: (MorphTreeColumn new rowMorphGetSelector: [:node | node item
> third asString asMorph ]; headerButtonLabel: 'Age' font: nil; yourself)
> with: (MorphTreeColumn new rowMorphGetSelector: [:node | node item
> fourth asString asMorph ]; headerButtonLabel: 'Gender' font: nil; yourself)).
>
> tree roots: {
> {'Benjamin'.'Van Ryseghem'.'26'.'M'}.
> {'Pamela'.'Anderson'.'Far too much'.'F'}
> }
>
> Ben
>
> Ben, in each cell, can we put something else than a String ? If so, can you
> add an example in the code above ? Thanks.
>
> I guess doing Ben's solution is the best. I did it with nested layout but it
> is definitely not as good (see file in attachment, add it in your image then
> evaluate SpecTable new).
>
>
> 2013/11/8 prova email <[email protected]>
> Hi Clement;
>
> I did the Spec tuto made by Bahman (great tuto). As him, i'd like to put some
> widgets into it. Is it possible? Maybe with the method "items:"? I don't know
> if the solution that Ben give to us (use Morphic instead of Spec) is
> suitable, that's because his UI looks like a list that accept only string.
> Maybe i'm wrong, can you give us more explanations? Or is it something new
> for you too?
>
> Thanks for your help!
> Paolo
>
> From: [email protected]
> Date: Thu, 7 Nov 2013 10:04:51 +0100
> To: [email protected]; [email protected]
> Subject: Re: [Pharo-users] Spec - Grid/Table Layout
>
>
> Hello,
>
> Actually I had the same problem, I think the best widget that exists for that
> right now is MultiColumnListModel.
>
> For example, in the senders window (in attachment), the top panel is a
> MultiColumnListModel. You can have as many lines and as many columns as you
> want.
>
> We do not have yet a tableLayout, but we miss it. If you plan to implement
> it, we will be interested in integrating it into Pharo.
>
> Ben can advise you on how to implement that.
>
>
>
>
> 2013/11/7 Bahman Movaqar <[email protected]>
> Hi all,
>
> Is there a grid/table layout available in Spec? Something like an HTML
> table or Swing's GridLayout? If not, how may I achieve such a
> functionality?
>
> I'd appreciate any hints/pointers.
>
> --
> Bahman Movaqar (http://BahmanM.com)
>
> ERP Evaluation, Implementation & Deployment Consultant
> PGP Key ID: 0x6AB5BD68 (keyserver2.pgp.com)