---
name: "tvSetCurSel"
type: command
status: ok
groups: ["GUI Control - Tree View"]
arma3_since: "0.74"
locality: {"argument": null, "effect": null, "server_exec": false}
source: https://community.bistudio.com/wiki/tvSetCurSel
revid: 369062
updated: 2024-09-02T20:24:55Z
---

# tvSetCurSel

*Command · GUI Control - Tree View · Arma 3 v0.74*

## Description

Sets cursor to given item on given path. IDC means id of parent Tree View. To deselect all items use [-1] for the path param (*available since Arma 3 v1.56*)

## Syntax

### Syntax 1

```sqf
tvSetCurSel [idc, path]
```

**Parameters:**

- `idc`: [Number](../topics/Number.md)
- `path`: [Array](../topics/Array.md) of [Number](../topics/Number.md)s

**Returns:** [Nothing](../topics/Nothing.md)

### Syntax 2

```sqf
control tvSetCurSel path
```

**Parameters:**

- `control`: [Control](../topics/Control.md)
- `path`: [Array](../topics/Array.md) of [Number](../topics/Number.md)s

**Returns:** [Nothing](../topics/Nothing.md)

## Examples

### Example 1

```sqf
tvSetCurSel [101, [0]];
```

### Example 2

```sqf
_ctrl tvSetCurSel [0,0,0];
```

### Example 3

```sqf
0 spawn
{
    disableSerialization;
    _CT_TREE = findDisplay 46 ctrlCreate ["RscTree", -1];
    _CT_TREE ctrlSetPosition [0,0,0.3,1];
    _CT_TREE ctrlCommit 0;
    _CT_TREE tvAdd [[],"Parent_A"];
    _CT_TREE tvAdd [[0],"Child_A"];
    _CT_TREE tvAdd [[0,0],"Grandchild_A"];
    _CT_TREE tvAdd [[],"Parent_B"];
    _CT_TREE tvAdd [[1],"Child_B"];
    sleep 1;
    hint "SELECT [0,0,0]";
    _CT_TREE tvSetCurSel [0,0,0];
    sleep 2;
    hint "DESELECT ALL";
    _CT_TREE tvSetCurSel [-1];
};
```

## See also

[tvAdd](../commands/tvAdd.md) · [tvClear](../commands/tvClear.md) · [tvCollapse](../commands/tvCollapse.md) · [tvCount](../commands/tvCount.md) · [tvCurSel](../commands/tvCurSel.md) · [tvData](../commands/tvData.md) · [tvDelete](../commands/tvDelete.md) · [tvExpand](../commands/tvExpand.md) · [tvPicture](../commands/tvPicture.md) · [tvSetData](../commands/tvSetData.md) · [tvSetPicture](../commands/tvSetPicture.md) · [tvSetValue](../commands/tvSetValue.md) · [tvSort](../commands/tvSort.md) · [tvSortByValue](../commands/tvSortByValue.md) · [tvText](../commands/tvText.md) · [tvValue](../commands/tvValue.md)

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