LineFromIndex

>>-anEditControl~LineFromIndex(--index--)----------------------><


The LineFromIndex method retrieves the one-based line number that contains the character index index.

Arguments:

The only argument is:

index

The one-based character index contained in the line whose number is to be retrieved.

Return value:

The line number containing the specified character index. The first line starts at index 1. If the specified index exceeds the number of characters contained in the edit control or an invalid character index was specified, 0 is returned.

Example:

The following example displays the line in which character 55 is contained:

edit = MyDialog~GetEditControl("TEXT")
if edit == .Nil then return

"It is easy to learn and easy to use." || 13~d2c || 10~d2c ||,
"Have fun with it!"
say "Character 55 is contained in line" edit~LineFromIndex(55)

Result: Character 55 is contained in line 2