---
name: "ctrlTextSelection"
type: command
status: ok
groups: ["GUI Control"]
arma3_since: "2.00"
locality: {"argument": null, "effect": null, "server_exec": false}
source: https://community.bistudio.com/wiki/ctrlTextSelection
revid: 377654
updated: 2026-01-02T09:02:02Z
---

# ctrlTextSelection

*Command · GUI Control · Arma 3 v2.00*

## Description

Returns edit control text selection in format [start, length, selectedText].

> [!NOTE]
> *length* can be negative if text selection is made from right to left. Use [abs](../commands/abs.md) with *length* or [count](../commands/count.md) with `selectedText` if string length is required. *start* always indicates at what position in text the selection is started. The cursor position will always be at the end of the selection. So if selection is made from right to left the cursor position will be at the left end of the selection. In order to find cursor position add *start* and *length* together (see [#Example 3](../commands/ctrlTextSelection.md#example-3)).

## Syntax

```sqf
ctrlTextSelection control
```

**Parameters:**

- `control`: [Control](../topics/Control.md)

**Returns:** [Array](../topics/Array.md) with [start, length, selectedText]
- start: [Number](../topics/Number.md) - position in text selection started
- length: [Number](../topics/Number.md) - number of the highlighted characters (this number could be negative, see description)
- selectedText: [String](../topics/String.md) - selected text

## Examples

### Example 1

Selection is made from left to right:

```sqf
ctrlTextSelection _control; //[0, 11, "Hello World"];
```

### Example 2

Selection is made from right to left:

```sqf
ctrlTextSelection _control; //[11, -11, "Hello World"];
```

### Example 3

Find cursor position:

```sqf
ctrlTextSelection _control params ["_start", "_length"];
private _cursorPos = _start + _length;
```

## See also

[ctrlSetTextSelection](../commands/ctrlSetTextSelection.md)

<sub>Source: [BI Community Wiki — ctrlTextSelection](https://community.bistudio.com/wiki/ctrlTextSelection) (revision 377654).</sub>
