TextEdit.LineNumAtCharPos
From Xojo Documentation
This item was deprecated in version 2019r2. Please use TextEdit.LineNumber as a replacement. |
Method
TextEdit.LineNumAtCharPos(CharPosition as Integer) As Integer
Supported for all project types and targets.
Supported for all project types and targets.
Returns (as an Integer) the line number in which the CharPosition character appears.
Notes
Characters are numbered consecutively with the first character numbered 1. The first line is numbered zero. Used with ScrollPosition, this lets you scroll the control to a particular place in the text.
The line number reflects line breaks from both hard line breaks in the text and soft line breaks caused by word-wrapping within the control.
Example
Gets the line number for the character at position 100:
This example searches a TextArea using text provided in a TextField and then scrolls to the text in the TextArea: