Page 1 of 1

counting lines with no CR

Posted: Thu Oct 08, 2009 6:50 pm
by gyroscope
Hi, I'm going to kick myself here, I know:

I have a field which does not accept returns. On a button click I wish to put the amount of actual lines in the field into a variable.
The problem is if there is more than one line without returns, it still counts the lines as 1 (i.e as 1 wrapped line). I need to know the amount of visible lines in the field.

So my question please:

How to count the actual lines showing in a field

I should know this but I've forgotten, sorry... :(

Any help appreciated.

:)

Posted: Thu Oct 08, 2009 8:07 pm
by FourthWorld
The formattedText property of fields will return the contents of a field with hard returns inserted where the field has soft-wraps. So you could write:

get the number of lines of (the formattedText of fld 1)

Posted: Fri Oct 09, 2009 12:02 am
by gyroscope
Excellent, thank you Richard.

:)