Scrolling to beginning of selected line in a text field
james at thehales.id.au
Thu Jul 12 02:17:08 EDT 2012
I have a text field with a large amount of text being displayed.
I also have a search routine that returns line numbers for all lines of the field containing the terms i have searched for.
These search results are displayed using a datagrid with its row behaviour set to select the line number corresponding to this search result.
This all works very well except for the following problem.
When I click on the row in the result list the text field highlights the appropriate line and scrolls to it but only displays the end of this line at the top of the field. The rest of the highlighted line is above the top edge of the field and thus not visible.
It seems Livecode sets the vscroll of the field based on the end of the line, not its start.
Given the "lines" I am displaying are actually paragraphs of text, I end up only seeing the last few words of the paragraph and have to scroll the field manually to see the entire paragraph.
Is this the intended behaviour of the "select line" command?
Does anyone have a way of adjusting this so that the entire line selected is displayed?
My current workaround is to select the previous line (which is usually empty but may not always be) as this leaves the wanted line fully displayed at the top of the text field but not highlighted.
More information about the Use-livecode