Skip to content

XUITextSelection

Description

Represents a selection of text within the code editor.

Properties

Name Type Read-Only
Anchor Integer
EndLocation Integer
Length Integer
StartLocation Integer

Methods

Name Parameters Returns
Clone XUITextSelection
Constructor anchor As Integer, startPos As Integer, endPos As Integer
ContainsColumn column As Integer Boolean
ContainsLine line As XUICELine Boolean
InRange value As Integer, lower As Integer, upper As Integer Boolean
IntersectsLine line As XUICELine Boolean
SelectedColumnsInLine line As XUICELine XUICESelectedColumns

Property Descriptions

Anchor As Integer

0-based position of this selection's anchor (original caret starting position).


EndLocation As Integer

0-based end position of this text selection.


Length As Integer

The length of this selection.


StartLocation As Integer

0-based start position of this selection.


Method Descriptions

Clone() As XUITextSelection

Returns a deep clone of this object.


Constructor(anchor As Integer, startPos As Integer, endPos As Integer)

Default constructor.

  • anchor is the 0-based location of the anchor.
  • startPos is the 0-based start position of this selection.
  • endPos is the 0-based end position of this selection.

The anchor marks the position that the selection began. Typically this will be the caret position when the selection begins but it's not necessarily the same as the start position. The anchor is typically set to -1 when it is not required.


ContainsColumn(column As Integer) As Boolean

True if column is within this selection.


ContainsLine(line As XUICELine) As Boolean

Returns True if this selection entirely contains line.

A line is considered to be contained by a selection if both its start and end locations are within this selection.


InRange(value As Integer, lower As Integer, upper As Integer) As Boolean

Returns True if value is within the passed bounds.


IntersectsLine(line As XUICELine) As Boolean

Returns True if any of this selection intersects line.

A line is intersected by a selection if any character of the line is within it.


SelectedColumnsInLine(line As XUICELine) As XUICESelectedColumns

If line is wholly or partly contained within this selection then returns the columns selected or Nil.

Returns an object representing the start and end columns contained by this selection or Nil if this selection does not intersect line. If this selection extends beyond the length of this line then the returned TextSelection will have its EndLocation set to -1. If this selection begins before this line then the returned TextSelection will have its Anchor set to -1. Otherwise it's set to 0.