My wishful thinking hearing about a new lead got me over excited. I
still have not found a way to make it work without looking at every
character and simulating the word wrap myself... yuck!
Consider we have the following in a field 1 and pretend the line breaks
you see are really the soft wrap points of a single line 1, and we are
trying to get the scroll point for where char 12 is the first visible
line: (remember the soft wrap occurs on a whitespace characters)
1234 6789
123456 890
234
* the formattedheight of line 1 of fld 1 get us the total height of
the line
* item 4 of the formattedrect of line 1 of fld 1 - item 2 of the
formattedrect of line 1 of fld 1 also gives us the total height
* item 4 of the formattedrect of char 1 to 12 of fld 1 - item 2 of the
formattedrect of char 1 to 12 of fld 1 gives us the height from the
top of the first soft line to the bottom of the second soft line.
Unfortunately we need the TOP of the second soft line.
* if we use the trick of selecting the last line and then selecting
the current line, vScroll - the height of the line will give is the
height of the last soft line 123. Close but no cigar.
Any other suggestions?
I would like to see a new feature where we provide a line number in a
field and we get a list of start and end character of each soft line
something like: get linedetails of line 1 of fld 1 would return:
1,10
10,21
22,24 -- remember the soft wrap occurs on a whitespace character
the number of lines it would tell us the number of soft lines
the number of words in char 1 to 10 of fld 1 tells us the number of
words in the first soft line.
the formattedrect of char 10 to 21 of fld 1 tells us the height of the
second soft line.
This is the most flexible solution I could come up with. Other solution
welcome. ;-)
Regards,
Mike
On 11/18/14 2:38 PM, Michael Doub wrote:
I think that you are correct! That was the lead that I was missing.
Thanks!
Mike
On 11/18/14 2:04 PM, Scott Rossi wrote:
If I understand what you¹re asking, I believe you can use the
formattedRect for this.
Regards,
Scott Rossi
Creative Director
Tactile Media, UX/UI Design
On 11/18/14, 10:23 AM, "Michael Doub" <miked...@gmail.com> wrote:
A related question to positioning a line within a field, is positioning
a chunk within a line that is wrapped. I am stumped on this one
and it
may need engine support. I don't know how to figure out the scroll
value of something in the middle of a wrapped line. In the thread
discussing scroll positioning within a wrapped field we see how to find
the top. I figured out how to get the bottom using James Hales
approach. (code in the forum and MasterLibrary)
Does anyone see a way to calculate the scroll position of a chunk
within
a line that is wrapped?
Regards
Mike
On 11/18/14 1:01 PM, Richard Gaskin wrote:
Michael Doub wrote:
I don't think the solution works because of a bug in livecode where
spacebefore and spaceafter are not taken into account.
Thanks - I wasn't aware of that bug, but was able to find it:
<http://quality.runrev.com/show_bug.cgi?id=11688>
Hopefully it'll get addressed for 6.7.1 and 7.0.1, since it's needed
for a wide range of tasks relating to text metrics.
_______________________________________________
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your
subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
_______________________________________________
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your
subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
_______________________________________________
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode