the line number of the top line in a text field

James Hale james at thehales.id.au
Sun Jul 1 03:51:48 EDT 2012


Is there a way to determine the line number of the top line of a text field?

The field's textheight is NOT set as the text present comes from html and different heading levels are present.

Context:
I am using an rTree object to provide an hierarchical list of these headings and clicking on a node within the tree scrolls the field so that the appropriate line is placed at the top of the field.

Issue:
I would like to display the current section (heading) name in a small "heading" field above the display field based on the user scrolling through the field.
As they scroll past the next heading line I would like the "heading" field to reflect this.

However there doesn't seem to be a way of going the other way. Getting the line of the field sitting at the top of the field.

Its as if the field contents and its actual display are using two different systems, text chunks versus pixel graphics.
Livecode can seemlessly go from specifying the text chunk translating it to the appropriate pixel value of the vscroll, but it can't do the reverse.


James








More information about the use-livecode mailing list