0
votes

I have a Tree object in my Flex code. It's width is 100%, and it is contained by a Panel with width=200. I am using a custom itemrenderer that extends TreeItemRenderer.

I need the text in each node to word wrap if it's too big (as happens often). I have tried

label.wordWrap = true;

in my item renderer without any luck. Any other suggestions?

5

5 Answers

1
votes

If 'label' is an instance of the Label component, you won't be able to get it to wrap, no matter what you do, as the Label component doesn't support wrapping. Or, rather, is meant to be used only for single-line text.

If you are using a Label component, try using a Text component, instead. It's meant to display multi-line text.

1
votes

With the default TreeItemRenderer you just need to set two properties on your Tree to enable wordWrap:

tree.variableRowHeight = true;

tree.wordWrap = true;

Enjoy.

0
votes

What is the height that is set on the label? Is there enough room for the text to go vertically?

0
votes

try setting the label width to a constant width. If your not able to do this because it needs to be dynamic then you need to override the update functions and set the width of the label then. The problem is the label hasn't calculated the actual 100% width at the time of rendering so it doesnt know it has to warp or not.

0
votes

Dont Use Label. Use ' mx:Text width=" 100%" ' ( Text with 100% width) and it will wrap on its own.