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) signature.asc (565 bytes) Download Attachment |
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 <[hidden email]> Hi all, |
Such a UI
can be achieve with a MorphTreeMorph (therefor with a TreeModel in Spec). Maybe I should create a TableModel in addition since a TreeModel for this is a bit magic :)
Ben On 07 Nov 2013, at 10:04, Clément Bera <[hidden email]> wrote:
|
In reply to this post by Clément Béra
On 11/07/2013 12:34, Clément Bera
wrote:
Great. Now I have to check if I can put widgets in those "lines" and "columns" instead of just text?
No way! At least currently :-) I'm just too inexperienced for such serious stuff
-- Bahman Movaqar (http://BahmanM.com) ERP Evaluation, Implementation & Deployment Consultant PGP Key ID: 0x6AB5BD68 (keyserver2.pgp.com) signature.asc (565 bytes) Download Attachment |
On 07 Nov 2013, at 12:04, Bahman Movaqar <[hidden email]> wrote:
That’s a good way to learn :P Ben
|
In reply to this post by Clément Béra
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: [hidden email] Date: Thu, 7 Nov 2013 10:04:51 +0100 To: [hidden email]; [hidden email] 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 <[hidden email]> Hi all, |
In the example I gave with TreeColumn/MorphTreeColumn the block used to render the item
can return anything understanding #asMorph. So you can easily return any Morph you like there :)
Ben On 08 Nov 2013, at 12:18, prova email <[hidden email]> wrote:
|
In reply to this post by Picci Pharo
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 <[hidden email]>
SpecTable.st (9K) Download Attachment |
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: [hidden email] Date: Fri, 8 Nov 2013 12:51:06 +0100 To: [hidden email] 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 <[hidden email]>
|
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 Ben On 08 Nov 2013, at 13:45, prova email <[hidden email]> 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: [hidden email] Date: Fri, 8 Nov 2013 13:59:51 +0100 To: [hidden email] 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 Ben On 08 Nov 2013, at 13:45, prova email <[hidden email]> wrote:
|
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 <[hidden email]> wrote:
|
Very very very good Ben, thanks a lot. Last question: you use the "columns:" message, but it's not defined in TreeModel. You defined it here
MorphTreeAdapter>>#columns: columns: columns self widgetDo: [ :w | w columns: columns. w resizerChanged. w updateList ] in the brand new Class MorphTreeAdapter. What's the difference between define columns: here instead of in the TreeModel class? Great job and thank you! Paolo From: [hidden email] Date: Fri, 8 Nov 2013 14:15:46 +0100 To: [hidden email] Subject: Re: [Pharo-users] Spec - Grid/Table Layout 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 <[hidden email]> wrote:
|
It is definitely defined in TreeModel :)
Ben
On 08 Nov 2013, at 14:29, prova email <[hidden email]> wrote:
|
In reply to this post by Benjamin Van Ryseghem (Pharo)
+1
One day we should have a real table widget. stef
|
+100 - many a use case for Microsoft Excel is not computation, but just
processing and cross referencing tables of data using VLOOKUP [1]. I'd
love to give it up. The overarching need (and inspiration for a
tutorial when possible) is to load two CSV files and display matching
cells from both in one table.
[1] http://spreadsheets.about.com/od/excelfunctions/ss/vlookup.htm cheers -ben Stéphane Ducasse wrote: +1 One day we should have a real table widget. stef<Screen Shot 2013-11-07 at 11.53.08.png> can be achieve with a MorphTreeMorph (therefor with a TreeModel in Spec). Maybe I should create a TableModel in addition since a TreeModel for this is a bit magic :) Ben On 07 Nov 2013, at 10:04, Clément Bera [hidden email] wrote: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. <Screen Shot 2013-11-07 at 10.00.55 AM.png> 2013/11/7 Bahman Movaqar [hidden email] 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) |
In reply to this post by Benjamin Van Ryseghem (Pharo)
Hi Ben,
are you sure that the message "widgetDo:" is the right one? It's not a message that my object looks to understand. Thanks in advance. Paolo From: [hidden email] Date: Fri, 8 Nov 2013 14:34:18 +0100 To: [hidden email] Subject: Re: [Pharo-users] Spec - Grid/Table Layout It is definitely defined in TreeModel :) Ben
On 08 Nov 2013, at 14:29, prova email <[hidden email]> wrote:
|
I am sure that Adapters understands widgetDo:
To which objects do you send this message ?
Ben On 11 Nov 2013, at 11:08, prova email <[hidden email]> wrote:
|
I'm doing a TreeModel. As you know, widgetDo is not a message of TreeModel, that's why i was asking you if there something wrong. As i asked you in a old post, column: is not a message of TreeModel, so, where do i have to create that message? The following code means to me that i have to create column: into MorphTreeAdapter, a class that i haven't got into my Pharo 2.0.
MorphTreeAdapter>>#columns: columns: columns self widgetDo: [ :w | w columns: columns. w resizerChanged. w updateList ] Paolo From: [hidden email] Date: Mon, 11 Nov 2013 12:03:13 +0100 To: [hidden email] Subject: Re: [Pharo-users] Spec - Grid/Table Layout I am sure that Adapters understands widgetDo: To which objects do you send this message ? Ben On 11 Nov 2013, at 11:08, prova email <[hidden email]> wrote:
|
Now I get it :)
This is not supported in 2.0 in the sense that the Spec version shipped with Pharo 2.0 has evolved :) You can try it in Pharo 3.0 :) Ben
On 11 Nov 2013, at 12:08, prova email <[hidden email]> wrote:
|
Free forum by Nabble | Edit this page |