Get the height of multiline text field with word wrap

Anything beyond the basics in using the LiveCode language. Share your handlers, functions and magic here.

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
CenturyMan1979
Posts: 86
Joined: Tue May 15, 2012 5:56 pm

Get the height of multiline text field with word wrap

Post by CenturyMan1979 » Mon Aug 04, 2014 5:03 pm

Hey All,

I have a text field that has the fixedLineHeight set to false and is set to word wrap. Is there a way to get the height of a line of text when the field is wrapping text to make it multiple lines high. I don't know how many lines will be in the text field and since it is text that is wrapped livecode sees it as only 1 line of text so I can't simply divide the formatted height of the text by the number of lines. I have been looking at text properties but can't seem to find anything to give me the height of a line of text in pixels.

bn
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 4163
Joined: Sun Jan 07, 2007 9:12 pm

Re: Get the height of multiline text field with word wrap

Post by bn » Mon Aug 04, 2014 7:24 pm

Hi 1979,

How do you determine which line of the wrapped _apparent_ lines you want the textHeight of?

It is not clear to me what exactly you are trying to do. You could get the formattedHeight of char x to y of field "z", or the formattedHeight of word x to y of field "z".
It all depends what you want to do.

If you could upload a zipped sample stack with just sample data in the field and give a little more detail that would help.

Kind regards
Bernd

Post Reply