I can see why the formattedHeight would not work. It takes into account line wraps as well as line breaks, and a variable or property cannot wrap text.
Apart from putting the text in question into a hidden field of the exact dimensions, and then checking the formatted height of that, I don't see a way. That may cause serious performance issues. Bob On Nov 27, 2010, at 8:23 AM, Richard Gaskin wrote: > I need to know the vertical coordinates in pixels of the beginning and end > points for a chunk of text in a scrolling field. > > I'm currently using the selectedLoc on the first and last char of the text > run, locking the screen and messages while I get that. > > The problem is that I sometimes need to do this a thousand times in > succession before I can return control to the user, and this causes > significant delay. > > Because the text contains runs of variable height, I can't rely on line > counts multiplied by the number of lines to the character in question. > > And because the text may contain Unicode, I can't rely on the formattedText > for any of this either. > > And it seems that the formattedHeight works great for the full field, but > cannot be used on chunks (I hope I misunderstand that, but I couldn't get any > such syntax to work). > > And yes, the field resizes with the window, so I need to also recalculate on > resizeStack as well. > > > I briefly experimented with the mouseChunk, hoping that I could set and then > restore the screenMouseLoc as needed, and while it sometimes works it really > screws up the pointer interaction, no matter how cleverly I try to hide the > cursor during that brief moment; and worse, the mouseChunk only returns a > value when the mouse is actually over text, and sometimes blank lines may be > there instead. > > I'm hoping there's some magically fast way to get those measurements without > having to actually touch the field contents, which is apparently an > inherently slow action (relatively speaking). > > Anyone here know of such magic? > > -- > Richard Gaskin > Fourth World > LiveCode training and consulting: http://www.fourthworld.com > Webzine for LiveCode developers: http://www.LiveCodeJournal.com > LiveCode Journal blog: http://LiveCodejournal.com/blog.irv > > _______________________________________________ > 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