How wordwrap in flex tree node

I have a Tree object in my Flex code. The width is 100% and it is contained in a panel with width = 200. I am using a custom itemrenderer that extends TreeItemRenderer.

I need the text in each node to wrap words if it's too big (as is often the case). I tried

label.wordWrap = true;

      

in my things renderer with no luck. Any other suggestions?

0


a source to share


5 answers


If "label" is an instance of a Label component, you cannot wrap it no matter what you do, since the Label component does not support wrapping. Or rather, intended to be used for single line text only.



If you are using the Label component, try using the Text component. It is designed to display multi-line text.

+1


a source


With the default TreeItemRenderer, you need to set two properties on your tree to enable wordWrap:

tree.variableRowHeight = true;

tree.wordWrap = true;

      



Enjoy.

+1


a source


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

0


a source


try setting the width of the labels to a constant width. If you can't do that because it needs to be dynamic, you need to override the update functions and then set the width of the label. The problem is that the label hasn't calculated its actual 100% width at render time, so it doesn't know if it should warp or not.

0


a source


Don't use a shortcut. Use "mx: text width =" 100% "(text with 100% width) and it will wrap on its own.

0


a source







All Articles