calculateWidths() (with the s on the end).  This will start at the top of the tree and open every node, measuring the widths and then return the width you could use.  By default the Tree will scan up to the first 10,000 nodes.  If you want to specify a smaller number (like you know the first subtree has a max of 100 nodes and nothing below will be wider) you can specify it as an argument to calculateWidths(maxNodesToMeasure).

 

Matt

 


From: [email protected] [mailto:[email protected]] On Behalf Of pilby1
Sent: Monday, May 23, 2005 11:47 AM
To: [email protected]
Subject: [flexcoders] Tree component's calculateWidth() method, does it work?

 

I have a panel that houses a tree control. I have noticed that the
tree's horizontal scrollbar has a bad habit of appearing when it
shouldn't, so I had decided to set its hScrollPolicy to "off", and
thereafter turning it on manually as needed.

In order for this to be possible, I need to know the width of the tree
after a node has been opened. This is because an opened node could
effectively make the tree width wider, depending on how long the text
of the child nodes are.

Checking the documentation, it seems like the method, calculateWidth
(), is my answer. However, doing tree.calculateWidth() always returns
NaN, making it useless.

Am I using it wrong? Or is it even known to work?

Any feedback from anyone would be greatly appreciated, because I need
to make my tree component behave. Thanks.





Yahoo! Groups Links

Reply via email to