# ITextSelection

> Interface to access a TextElement selection and cursor information This interface is not meant to be implemented explicitly as its declaration might change in the future.

## Definition

* **Type:** Interface
* **Namespace:** [UnityEngine.UIElements](/engine/6000.5/script-reference/unityengine/uielements.md)
* **Assembly:** UnityEngine.UIElementsModule

```csharp
public interface ITextSelection
```

## Properties

| Property                                                                                                                  | Description                                                                                                                                                |
| ------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------- |
| [cursorIndex](/engine/6000.5/script-reference/unityengine/uielements/itextselection/cursorindex.md)                       | This is the cursor index in the text presented.                                                                                                            |
| [cursorPosition](/engine/6000.5/script-reference/unityengine/uielements/itextselection/cursorposition.md)                 | The position of the text cursor inside the element's [\_contentRect](/engine/6000.5/script-reference/unityengine/uielements/visualelement/contentrect.md). |
| [doubleClickSelectsWord](/engine/6000.5/script-reference/unityengine/uielements/itextselection/doubleclickselectsword.md) | Controls whether double-clicking selects the word under the mouse pointer.                                                                                 |
| [isSelectable](/engine/6000.5/script-reference/unityengine/uielements/itextselection/isselectable.md)                     | Returns true if the field is selectable.                                                                                                                   |
| [selectAllOnFocus](/engine/6000.5/script-reference/unityengine/uielements/itextselection/selectallonfocus.md)             | Controls whether the element's content is selected upon receiving focus.                                                                                   |
| [selectAllOnMouseUp](/engine/6000.5/script-reference/unityengine/uielements/itextselection/selectallonmouseup.md)         | Controls whether the element's content is selected when you mouse up for the first time.                                                                   |
| [selectIndex](/engine/6000.5/script-reference/unityengine/uielements/itextselection/selectindex.md)                       | This is the selection index in the text presented.                                                                                                         |
| [tripleClickSelectsLine](/engine/6000.5/script-reference/unityengine/uielements/itextselection/tripleclickselectsline.md) | Controls whether triple-clicking selects the entire line under the mouse pointer.                                                                          |

## Methods

| Method                                                                                                                                        | Description                                                                                                    |
| --------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------- |
| [GetCursorPositionFromStringIndex](/engine/6000.5/script-reference/unityengine/uielements/itextselection/getcursorpositionfromstringindex.md) | The position inside the element's content box where the text cursor would be if it were at the selected index. |
| [HasSelection](/engine/6000.5/script-reference/unityengine/uielements/itextselection/hasselection.md)                                         | Return true is the TextElement has a selection.                                                                |
| [MoveBackward](/engine/6000.5/script-reference/unityengine/uielements/itextselection/movebackward.md)                                         | Moves the cursor backward by one character.                                                                    |
| [MoveForward](/engine/6000.5/script-reference/unityengine/uielements/itextselection/moveforward.md)                                           | Moves the cursor forward by one character.                                                                     |
| [MoveToEndOfPreviousWord](/engine/6000.5/script-reference/unityengine/uielements/itextselection/movetoendofpreviousword.md)                   | Moves the cursor to the end of the previous word.                                                              |
| [MoveToParagraphEnd](/engine/6000.5/script-reference/unityengine/uielements/itextselection/movetoparagraphend.md)                             | Moves the cursor to the end of the current paragraph.                                                          |
| [MoveToParagraphStart](/engine/6000.5/script-reference/unityengine/uielements/itextselection/movetoparagraphstart.md)                         | Moves the cursor to the start of the current paragraph.                                                        |
| [MoveToStartOfNextWord](/engine/6000.5/script-reference/unityengine/uielements/itextselection/movetostartofnextword.md)                       | Moves the cursor to the start of the next word.                                                                |
| [MoveWordBackward](/engine/6000.5/script-reference/unityengine/uielements/itextselection/movewordbackward.md)                                 | Moves one word backward.                                                                                       |
| [MoveWordForward](/engine/6000.5/script-reference/unityengine/uielements/itextselection/movewordforward.md)                                   | Moves one word forward.                                                                                        |
| [SelectAll](/engine/6000.5/script-reference/unityengine/uielements/itextselection/selectall.md)                                               | Selects all the text contained in the field.                                                                   |
| [SelectNone](/engine/6000.5/script-reference/unityengine/uielements/itextselection/selectnone.md)                                             | Remove selection                                                                                               |
| [SelectRange](/engine/6000.5/script-reference/unityengine/uielements/itextselection/selectrange.md)                                           | Select text between cursorIndex and selectIndex.                                                               |

## Events

| Member                                                                                                              | Description                                               |
| ------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------- |
| [OnCursorIndexChange](/engine/6000.5/script-reference/unityengine/uielements/itextselection/oncursorindexchange.md) | Event that is triggered when the cursor index changes.    |
| [OnSelectIndexChange](/engine/6000.5/script-reference/unityengine/uielements/itextselection/onselectindexchange.md) | Event that is triggered when the selection index changes. |
