Flex – How to set the TextArea height to its content height

I have a mx: TextArea, and I want it to be the same height as its content. Nothing special-just a non-editable text area and text. I need something simple and reliable Method to make the control fit and display all the text without vertical scrolling-just like auto-resize. In addition, the text of my control will only be set once and will not change because it is not editable.

 editable="false"
width="100%"
verticalScrollPolicy="off" >

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nulla id lorem
quis ante pulvinar auctor at eget risus. Nulla facilisi. Morbi ultricies
dignissim loremit, quis cipsus felis ullamcorper et.

There is also a here post on the same topic, but it has nothing to do with me because it’s The setup is more complicated because it includes styles and bindings.

Use TextArea’s textHeight read-only property, And set the height of the TextArea to TextArea.textHeight The vertical padding used by the TextArea plus the height of the top and bottom borders (check the TextArea component and calculate it). This process should be done in the handler of the change event you add to the TextArea. < /div>

I have a mx: TextArea, I want it to be the same height as its content. Nothing special-just a non-editable text area and text. I need a simple and reliable method To make the control fit and display all text without vertical scrolling-just like a self It’s the same as when it is automatically resized. In addition, the text of my control will only be set once and will not be changed because it is not editable.

 editable="false"
width="100%"
verticalScrollPolicy="off" >

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nulla id lorem
quis ante pulvinar auctor at eget risus. Nulla facilisi. Morbi ultricies
dignissim lorem, quis suscipit felis ullamcorper et.

>

There is also a here post on the same topic, but it has nothing to do with me because its setup is more complicated because it includes styles and bindings.

< /p>

Use the textHeight read-only property of TextArea, and set the height of TextArea to TextArea.textHeight The vertical padding used by TextArea plus the height of the top and bottom borders (check the TextArea component and calculate Out). This process should be carried out in the handler of the change event you added to the TextArea.

Leave a Comment

Your email address will not be published.