Another example, (modified TreeModel example)

|r m col1 col2 col3|
r := FileLocator vmDirectory.
    m := TreeModel new.
    m roots: r allFiles.
    m rootNodeHolder: [ :item |
        TreeNodeModel new
            content: item;
            icon: Smalltalk ui icons smallLeftFlushIcon
    ];
    title: r fullName.
    col1 := TreeColumnModel new
        displayBlock: [ :node | node content basename ];
        headerLabel:'Name'.
    col2 := TreeColumnModel new
        displayBlock: [ :node | node content creationTime ];
        headerLabel:'Time'.
    col3 := TreeColumnModel new
        displayBlock: [ :node | node content permissions];
        headerLabel:'Permissions'.
    m columns: {col1. col2 . col3}.
    m openWithSpec.




2015-02-15 23:30 GMT+01:00 Sven Van Caekenberghe <s...@stfx.eu>:

> This is the easiest way that I know to show a simple table.
>
> MultiColumnListModel new
>   items: #(('x coordinate' 'y coordinate' 'z coordinate')(1 2 3)(4 5 6)(7
> 8 9));
>   displayBlock: [ :x | x collect: #asString ];
>   setSelectedIndex: 2;
>   title: 'My table';
>   openWithSpec.
>
> > On 15 Feb 2015, at 22:36, Craig <cr...@hivemind.net> wrote:
> >
> > Hi Sven,
> >
> > I count myself as a beginner with Pharo, although I've been dabbling
> with Pharo UI choices for a few months now.
> > Like Sebastian, I wrote Spec off as too immature for prime-time, but I
> too come from the commercial
> > world, so maybe my expectations were unrealistic.
> >
> > So I took the time to learn Spec.  My very first requirement is to
> display some data in a grid or table like manner, so I took a look at the
> TreeModel, and tried to adapt one of the examples to fit.  However,
> whenever I try to add a third column to the model, I get a "Subscript Out
> of Bounds".
> > I also tried to change the oddRowColor, but it had no effect.
> >
> > I hope that is specific enough for you.
> >
> > Craig
> >
> > -----Original Message-----
> > From: Pharo-users [mailto:pharo-users-boun...@lists.pharo.org] On
> Behalf Of Sven Van Caekenberghe
> > Sent: 13 February 2015 11:12 AM
> > To: Any question about pharo is welcome
> > Subject: [Pharo-users] Learning Spec
> >
> > Hi,
> >
> >
> > From now on it is forbidden to complain about Spec in general,
> unspecific terms unless you have taken the time to learn about it. Here is
> a guide to documentation about Spec, most recent first.
> >
> >
> > There is an excellent presentation by Johan Fabry did during the last
> Pharo Days, 'Using Spec to Build a UI'. *MUST WATCH* (the video is not yet
> fully public, but soon will be, the link should work though):
> >
> >  http://youtu.be/OL23s9ZUIR0?list=PL4actYd6bfnz98ngrKALwwStl3C3odEKG
> >
> > The slides are also not yet available, but soon will be (the talk is
> much better that the slides on their own).
> >
> >
> > This draft chapter 'Spec: a framework for describing user interfaces'
> for an upcoming book:
> >
> >
> https://ci.inria.fr/pharo-contribution/view/Books/job/PharoBookWorkInProgress/lastSuccessfulBuild/artifact/Spec/Spec.pier.html
> >
> >
> > Look in the image.
> >
> > Browse the hierarchy below AbstractWidgetModel in the category
> Spec-Core-Widgets in Pharo 4, look at the protocols called 'protocol' &
> 'protocol-events' mainly. Look for references to each class. Trace senders
> of methods until you arrive at examples. Study the examples, play with
> them, change them.
> >
> > The UI of most tools in Pharo is also implemented using Spec. Browse the
> hierarchy below ComposableModel to find them. (Komitter, Versionner,
> Critics, Metacello, the old Eye Inspectors, ..). Watch and learn.
> >
> >
> > The cool Spec website:
> >
> >  http://spec.st
> >
> >
> > Read some cool articles like:
> >
> >
> https://medium.com/concerning-pharo/rediscovering-the-ux-of-the-legendary-hp-35-scientific-pocket-calculator-d1d497ece999
> >
> > See the section 'HP35CalculatorModel' for the Spec part.
> >
> >
> > The following papers (some older ones refer to API that has changed):
> >
> > 'Seamless Composition and Reuse of Customizable User Interfaces with
> Spec'
> >
> >  http://rmod.lille.inria.fr/archives/papers/Ryse13a-SCICO-Spec.pdf
> >
> > 'Spec - A Framework for the Specification and Reuse of UIs and their
> Models'
> >
> >
> http://rmod.lille.inria.fr/archives/papers/Ryse12b-Spec-IWST12-Final.pdf
> >
> > 'Spec – Technical Report'
> >
> >  http://rmod.lille.inria.fr/archives/reports/Ryse12a-SpecTechReport.pdf
> >
> >
> > Use the image to build a couple of simple UIs using Spec. You will be
> surprised to learn that it is not that difficult. Just go with the flow,
> don't try to enforce your world view on it, wait until you are further
> along.
> >
> >
> > Have fun !
> >
> >
> > Sven
> >
> >
> > PS: Once you have done all the above, you are most welcome to help
> improve Spec by discussing specific, concrete issues.
> >
> >
> > --
> > Sven Van Caekenberghe
> > Proudly supporting Pharo
> > http://pharo.org
> > http://association.pharo.org
> > http://consortium.pharo.org
> >
> >
> >
>
>
>

Reply via email to