line wraps

Ken Ray kray at sonsothunder.com
Mon Jun 11 01:43:19 EDT 2007


On Sun, 10 Jun 2007 22:30:54 -0700, -= JB =- wrote:

> How can I find which character of a line the
> line break is used when a line wraps.
> 
> I know it can be done with various math
> calculations by setting the dontwrap to
> false and comparing it with the width of
> the field but it is a bad idea visually due
> to if the lockscreen is true it still shows the
> line wrap being changed when you set
> the dontwrap property.

Depending on the line you want to check, you can use the 
'formattedText' property - which will return you the data from the 
field with hard returns where it has wrapped naturally. So to get the 
number of characters for the first line of text in a field:

  put length(line 1 of the formattedText of field 1)

Keep in mind that the problem with calculating the number of characters 
is that proportional fonts will mess up your calculations. 

But hopefully this puts you on the right course,

Ken Ray
Sons of Thunder Software, Inc.
Email: kray at sonsothunder.com
Web Site: http://www.sonsothunder.com/



More information about the use-livecode mailing list