Hi Nicolai,

All glamour browser open on a model object. The display block is used to extract from that model object the actual object that would be displayed. 
In the case of a tree presentation the display block should return the initial roots of three. So you can open the browser on any object, and then the display block would get that object as a parameter and return a list of objects that would be used as the roots of the tree.

For example, you could write 'browser openOn: FileSystem disk' and then have a display block that extracts the working directory from the file system (display: [ :filesystem | filesystem workingDirectory ];)
The whole example would look like:

   browser := GLMTabulator new.
    browser
        column: #tree;
        column: #text.
    browser transmit
        to: #tree;
        andShow: [ :a | 
                    a tree
                        title: 'FS';
display: [ :filesystem | filesystem workingDirectory ];
                        format: [ :item | item basename ];
                        children: [ :item | 
                                    item isDirectory
                                        ifFalse: [ #() ]
                                        ifTrue: [ item children ] ] ].
    browser openOn: FileSystem disk 


Cheers,
Andrei


On Tue, Feb 10, 2015 at 5:02 PM, Nicolai Hess <nicolaihess@web.de> wrote:
Why does a displayblock affect the arguments used for accessing the
children of the nodes?

The following code creates a TreePresentation from the current working Directory:

    browser := GLMTabulator new.
    browser
        column: #tree;
        column: #text.
    browser transmit
        to: #tree;
        andShow: [ :a |
                    a tree
                        title: 'FS';
                        "display: [ :item | item basename ];"
                        children: [ :item |
                                    item isDirectory
                                        ifFalse: [ #() ]
                                        ifTrue: [ item children ] ] ].
    browser openOn: FileSystem disk workingDirectory.

As I don't want to see the FileReference printString, but the
name of the File, the first thing I tried is a displayblock like
the commented line above.

But after this change the children block does not work anymore.
The item it calls #isDirectory on, is not the FileSystem entry but the
name returned by the display block.

#format: instead of #display:  works:

    browser := GLMTabulator new.
    browser
        column: #tree;
        column: #text.
    browser transmit
        to: #tree;
        andShow: [ :a |
                    a tree
                        title: 'FS';
                        format: [ :item | item basename ];
                        children: [ :item |
                                    item isDirectory
                                        ifFalse: [ #() ]
                                        ifTrue: [ item children ] ] ].
    browser openOn: FileSystem disk workingDirectory

May examples from GLMBasicExamples are using #display: , thats why
I tried this first. What is the intention to use
the display block for accessing the children?

nicolai






_______________________________________________
Moose-dev mailing list
Moose-dev@iam.unibe.ch
https://www.iam.unibe.ch/mailman/listinfo/moose-dev