Sets selection range.

Namespace: Sgry.Azuki
Assembly: Azuki (in Azuki.dll) Version: 1.7.13.40248

Syntax

C#
public void SetSelection(
	int anchor,
	int caret,
	IView view
)
Visual Basic
Public Sub SetSelection ( 
	anchor As Integer,
	caret As Integer,
	view As IView
)

Parameters

anchor
Type: System..::..Int32
new index of the selection anchor.
caret
Type: System..::..Int32
new index of the caret.
view
Type: Sgry.Azuki..::..IView
a View object to be used for calculating position/index conversion.

Remarks

This method sets selection range and invokes Document.SelectionChanged event.

How text will be selected depends on the value of current SelectionMode as below.

  • If SelectionMode is TextDataType.Normal, characters from anchor to caret will be selected.

    Note that if given index is at middle of an undividable character sequence such as surrogate pair, selection range will be automatically expanded to avoid dividing it.

  • If SelectionMode is TextDataType.Line, lines between the line containing anchor position and the line containing caret position will be selected.

    Note that if caret is just at beginning of a line, the line will not be selected.

  • If SelectionMode is TextDataType.Rectangle, text covered by the rectangle which is graphically made by anchor position and caret position will be selected.

Exceptions

ExceptionCondition
System..::..ArgumentOutOfRangeExceptionSpecified index is out of valid range.
System..::..ArgumentNullExceptionParameter 'view' is null but current SelectionMode is not TextDataType.Normal.

See Also