On Wed, May 16, 2012 at 8:50 PM, Tudor Girba tudor@tudorgirba.com wrote:
Hi,
The children block is applied to every child. So, naturally, it has to work on every child :). So, one possibility to describe your situation would be like:
children: [:each | each isModule ifTrue: [each functions] ifFalse:
[#()]]
Another possibility would be to define the elements by level. There is a default variable on the last position in the block that holds the level of the current child. Please take a look at GLMBasicExamples>>treeWithChildrenByLevel.
In fact, I and André had discussed the same solutions before sending the mail :-). But I was thinking there might be a way to apply different treatment to roots and children nodes without conditional checks. thanx Usman
Cheers, Doru
On 16 May 2012, at 19:32, Usman Bhatti wrote:
Hello,
I am constructing a tree presentation with Glamour. Parents are modules
in my tree and children are a module's functions. Here is the code:
modulesIn: composite
^ composite tree title: 'All Modules'; showOnly: 50; display: [ :each | each allModules]; tags: [ :each | {each numberOfFunctions asString}
];
format: [ :each | each mooseName]; selectionAct: [:each | each selection inspect ]
on: $i entitled: 'Inspect';
icon: #mooseIcon; children: [:each | each functions ].
Now, when I click on a child, glamour wants to executes the children and
tags block on a function in the above code. Now since my functions do not understand the messages functions/numberOfFunctions, there is an error.
My question: for constructing a glamour tree, should parents and
children both understand the same API or am I missing something here?
thanx
Usman _______________________________________________ Moose-dev mailing list Moose-dev@iam.unibe.ch https://www.iam.unibe.ch/mailman/listinfo/moose-dev
-- www.tudorgirba.com
"From an abstract enough point of view, any two things are similar."
Moose-dev mailing list Moose-dev@iam.unibe.ch https://www.iam.unibe.ch/mailman/listinfo/moose-dev