views:

115

answers:

0

In Flex, I created a TextArea control and slapped in text data. If I do .setSelection(begin, end) and then call .setFocus() on the TextArea, it usually works fine (selected text comes into focus view correctly).

However, if I have wordwrapping turned OFF and let's say text goes beyond the visible horizontal viewing area of the TextArea control, the horizontal scroll bar never moves. In other words, calling .setfocus() will not autoscroll horizontally. This works fine vertically. If I manually scroll over horizontally, the .setSelection did indeed select the correct text.

Lastly, I have text editing turned off (read-only TextArea).

Thanks!

Edit: There appears to be something wrong with the metrics (bug in Flex?). I've done a little trick by creating a dummy label. After doing .setselection, I force .setFocus() into the label. I created an FocusIn event on label which dispatches an event to .setFocus() on the TextArea. This appears to "somewhat" work but it's still not 100%. Sometimes the horizontal bar scrolls over but not "enough".