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 <prova...@hotmail.it>

> 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: bera.clem...@gmail.com
> Date: Thu, 7 Nov 2013 10:04:51 +0100
> To: bah...@bahmanm.com; pharo-users@lists.pharo.org
> 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.
>
> [image: Images intégrées 1]
>
>
> 2013/11/7 Bahman Movaqar <bah...@bahmanm.com>
>
> 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)
>
>
>
>

Attachment: SpecTable.st
Description: Binary data

Reply via email to