How get height of a text selection in a field solved

LiveCode is the premier environment for creating multi-platform solutions for all major operating systems - Windows, Mac OS X, Linux, the Web, Server environments and Mobile platforms. Brand new to LiveCode? Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
jmburnod
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 2718
Joined: Sat Dec 22, 2007 5:35 pm
Location: Genève
Contact:

How get height of a text selection in a field solved

Post by jmburnod » Sun Jan 15, 2017 4:44 pm

Hi All,
I ‘m looking for a way to get the height of a text selection in a field (dontwrap = false).
The selectedLoc return the topleft of the selection.
If my brain work well I understand that I can't use the formattedheight of the text selection (I thought put the selectedtext in an other fld to get its formattedheight). That can't work because the selection can begin at the last word of a "visible line" and end at the first word two or more lines farest.
I hope I'm clear (that should be a good new for my english level). :D
Best regards and thanks in advance for your ideas
Jean-Marc
Last edited by jmburnod on Sun Jan 15, 2017 11:06 pm, edited 1 time in total.
https://alternatic.ch

[-hh]
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 2262
Joined: Thu Feb 28, 2013 11:52 pm
Location: Göttingen, DE

Re: How get height of a text selection in a field ?

Post by [-hh] » Sun Jan 15, 2017 10:40 pm

Hi Jean-Marc,

for my first answer I probably misunderstood what you want.

If I now understand correctly then you don't want to use the formattedHeight of the selectedText as it currently is, but you need it always as if it would start at the beginning of a line?

If this is correct then you could try to put (temporarily) a CR before the selectedChunk, select it again and measure it?

Hermann
shiftLock happens

jmburnod
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 2718
Joined: Sat Dec 22, 2007 5:35 pm
Location: Genève
Contact:

Re: How get height of a text selection in a field

Post by jmburnod » Sun Jan 15, 2017 11:06 pm

Hi Hermann,
Thanks again.
I didn't read completely the doc. :oops:
I thought that formattedheight only works with controls
Warm regards
Jean-Marc
https://alternatic.ch

Post Reply

Return to “Getting Started with LiveCode - Experienced Developers”