PDA

View Full Version : prevent user from folding Tree nodes...


_marabout
04-09-2006, 10:28 AM
Hi,

I plan to use the Tree component to represent a hierarchy of categories.

Basically this will be a list : every nodes will always be visible, I don't want to let the user fold nodes, I don't want the little arrows with branch nodes, and I don't want the icons neither...

Why not using a List will you tell me ? :confused: Because what is shown is truly a hierarchy and I will feed it with xml, so the Tree is the most 'natural' choice.

So what do I need to modify :
- hide arrows for branch nodes,
- hide nodes icons,
- deactivate the folding behavior for any branch node

Of course I don't want to use the enabled property since clicking on any item in the list will trigger an action.

Ideally, I'd prefer a solution based on playing with the properties/methods of the component... I wouldn't like to have to modify the component's code or build a custom one based on MM's (still I've started preparing myself emotionaly to it :rolleyes: )

If anyone has a clue for solving one or all of the problems listed above, I'm all ears (and eyes) !

_marabout
04-11-2006, 07:58 AM
Has someone a clue ?

_marabout
04-16-2006, 09:02 AM
It's been quite a pain but I've managed to make the tree look like it was designed to (the designer doesn't care about trees or other macromedia gifts, lucky... ) !

Actually a lot can be done with the tree styles, but of course the remaining little details will need twice the time needed for the rest... time spent crying and begging for google to produce the "magical trick" :)

OK so for hiding the arrows, branch and leaf icon it's :
// leaf icon
myTree.setStyle("defaultLeafIcon", "treeIcon");
// closed branch
myTree.setStyle("folderOpenIcon", "treeIcon");
// open branch
myTree.setStyle("folderClosedIcon", "treeIcon");
// arrow icon
myTree.setStyle("disclosureOpenIcon", "treeIcon");
myTree.setStyle("disclosureClosedIcon", "treeIcon");

where "treeIcon" is an empty clip linkage ID. Doing this you will loose the indentation (!). You can also use a transparent 16px square instead and then you'll keep the indentation, but also the "arrows" will stay active although invisible...

I kept the empty clip and used Alexandro Crugnola class example to customize more the tree (here (http://www.sephiroth.it/tutorials/flashPHP/custom_tree/)). This class will result in the correct indent despite of the empty icon clip. But more it allows to add lines between the tree cells... (of course everybody finds it normal to have to build a class to add lines between cells :rolleyes: )

So thank you Alexandro, and of course MM for helping us saving so much time with these wonderful components :rolleyes:

Ah last thing : does anyone knows how to keep the rollover behavior, but only for the text ? I mean changing the text's color but not the cell highlight on rollover? Of course choosing the cell color works... as long as you don't have several colors depending on cell depth (using the "depthColors" style)! Making the rollover highlight transparent would do it, but after 2 hours digging inside the components classes I didn't find a way to do so...

Anyone ?