GetSelRange Function (TextField)

Class

TextField.

Action

Returns the selected range in the text field.

Syntax

trSelection = textfield.GetSelRange()
Variable Description
trSelection The current selection. TEXTRANGE.

Notes

GetSelRange returns a TEXTRANGE record containing the start line, end line, start column, and end column values of the current selection range of the text field.

The TEXTRANGE data type contains four fields:
Field Description
iStartLine The first line in the range. INTEGER.
iStartCol The first column in the range. INTEGER.
iEndLine The last line in the range. INTEGER.
iEndCol The last column in the range. INTEGER.

If nothing is selected, the start and end are equal, and the position is that of the insertion point. A GetSelRange against a 0-character wide sel range for an HtmlTextField returns the end of the line.

The values in the column fields point to just before the columns themselves. Therefore, position 1 is the position just before the first character. The position at the end of the line is one more than the last character.

Example

TEXTRANGE trRange;
trRange = TextEditor.Document.GetSelRange()
Verify(trRange.iStartLine, 1, "Check starting line")
Verify(trRange.iStartCol, 1, "Check starting column")