can I get your code (from an attached change set as an example), it would be cool to make another example out of this.
btw, I will answer to your questions
Cheers
Alain

Le 06/03/2012 00:13, Alexis Parseghian a écrit :
I've been playing with MorphTree et al. for the past few days, trying
to understand how they work. Reading the example code in
Morphic-MorphTreeWidget-Examples helped. I've also been trying to
figure out the Settings Browser, but this one I have a hard time following :(

Anyway, I think I've got the basics now : I instantiate a
MorphTreeMorph when building my window in an subclass of a
MorphTreeModel. The contents of my model's list get wrapped in the
appropriate MorphTreeNodeModel subclasses.

I can get the tree to display *what* I want. My problem is with the
*how* ; more specifically, how to get the columns right.

* the first column always displays correctly, with or without an
expander (and in the latter case, expanded or not).
* the following columns have the text overlapping their left-side
resizer by about half a character.
* subsequent columns display off their vertical boundaries (to the
right), seemingly depending on the length of the preceeding column.
Same as if there were no columns but just morphs abutted to one
another. Manually resizing the previous column to contain the longest
text gets me back to the previous case (half a char too much to the
left). In other words, if I'm guessing right, the column clips its
contents /visually/, but not in relation to their /reported width/.

I'm pretty sure there's something really basic I've missed in the
layout, but I can't figure it out from the example code nor the
classes' protocols.

Any hints ?

Thanks.

My code:

* the root list is a collection of associations 'string' ->  article instance
* I'm building a view with the category (expandable) in the first
column. Once expanded, it shows the article's properties in columns.

CategoriesAndArticlesTree(MorphTreeModel)>>buildTree
        | treeMorph |
        treeMorph := (self treeMorphClass on: self)
                columns: {
                        MorphTreeColumn new rowMorphGetSelector:
#categoryOrAuthor.
                        MorphTreeColumn new
                                rowMorphGetSelector: #title;
                                headerButtonLabel: 'Title' font: nil.
                        MorphTreeColumn new rowMorphGetSelector: #issue.
                        MorphTreeColumn new rowMorphGetSelector: #foo
                 }.
        treeMorph
                hResizing: #spaceFill; vResizing: #spaceFill;
                withHLines: true;
                makeLastColumnUnbounded;
                resizerWidth: 1.
        ^ (treeMorph buildContents )
CategoriesAndArticlesTree>>rootNodeClassFromItem: anItem
        ^ CategoriesTreeNode

CategoriesTreeNode(MorphTreeNodeModel)>>categoryOrAuthor
        ^ self theme builder newLabel: item key
CategoriesTreeNode>>childNodeClassFromItem: anItem
        ^ ArticlesTreeNode
CategoriesTreeNode>>childrenItems
        ^ item value
the other column-related selectors are implemented and return a nil.

ArticlesTreeNode(MorphTreeNodeModel) implements the column-related
selectors by returning the appropriate article property wrapped in a
label.
ArticlesTreeNode>>categoryOrAuthor
        ^ self theme builder newLabel: item author
ArticlesTreeNode>>foo
        ^ self theme builder newLabel: 'foo'



Reply via email to