2015-02-10 17:38 GMT+01:00 Andrei Chis <chisvasileandrei@gmail.com>: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.browsercolumn: #tree;column: #text.browser transmitto: #tree;andShow: [ :a |a treetitle: 'FS';display: [ :filesystem | filesystem workingDirectory ];format: [ :item | item basename ];children: [ :item |item isDirectoryifFalse: [ #() ]ifTrue: [ item children ] ] ].browser openOn: FileSystem diskCheers,AndreiThank you for the explanation Andrei,I thought the display block is used to convert the data to a displayable representation.But if it is used to extract the data, then the described behavior makes sense of course.nicolaiOn Tue, Feb 10, 2015 at 5:02 PM, Nicolai Hess <nicolaihess@web.de> wrote:_______________________________________________#format: instead of #display: works:name returned by the display block.The item it calls #isDirectory on, is not the FileSystem entry but theBut after this change the children block does not work anymore.the commented line above.name of the File, the first thing I tried is a displayblock likeWhy does a displayblock affect the arguments used for accessing theAs I don't want to see the FileReference printString, but 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.
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 workingDirectoryMay examples from GLMBasicExamples are using #display: , thats whyI 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
_______________________________________________
Moose-dev mailing list
Moose-dev@iam.unibe.ch
https://www.iam.unibe.ch/mailman/listinfo/moose-dev