View Full Version : Get string on visual line (not wordwrapped) in a wordwrapped textarea?

Jun 23rd, 2008, 05:10 PM
Hi is there an easy way (method, property) to get the string occupying a "visual line" in a wordwrapped textarea?

What I mean by visual line:
A string of characters that does not spill into the line below it and occupies one line on the textarea, even if this line strays into the right-side scrolling portion of the textarea. How would a wordwrapped textarea manage to have a horizontal scroll bar you ask? Well, a line will have horizontal scrollbar when the # of chars occupying the line are more than the width dimensions of the textarea AND there are no spaces in the line. ie: sdddddNOSPACESddddddsddddddddddddddddddddddd

A simpleton solution is to determine where there are linebreaks and after that determine where there are more characters than what fits on a line. That in itself is a debatable matter, because how many characters that fit on a textarea line depend on their pixel width which is not uniform for all characters in the same pixel setting. IE: in the same pixel size the char 'a' will have different pixel width than '.'
A line full of '.' will have more characters occupying it than a line full of 'a'

-thanks for reading http://bstats.freehostia.com/b.gif