LineIndex

>>-anEditControl~LineIndex(--line--)---------------------------><


The LineIndex method retrieves the one-based character index of the beginning of the line in the associated edit control.

Arguments:

The only argument is:

line

The number of the line of which the starting index is to be retrieved. Line numbers are incremented by 1, starting with 1.

Return value:

The character index of the specified line. The first line starts at index 1.

Example:

The following example sets the text for edit control TEXT and displays the number of text lines (3), the starting index of the second line (carriage return, 0x0d, and line feed, 0x0a, which mark a line break, are also considered to be characters), and the length of the third line:

 
editControl = MyDialog~GetEditControl("TEXT")
if .nil == editControl then return

text = "It is easy to learn and easy to use." || '0d0a'x || -
       "Have fun with it!"                    || '0d0a'x || -
       "But don't over do it."

edit~setText(text)

say "Number of lines:" edit~lines
say "Line 2 begins at index" edit~LineIndex(2)
say "Length of 3rd line:" edit~LineLength(3)

Result: Number of lines: 3
        Line 2 begins at index 39
        Length of 3rd line: 21