---
name: "tvAdd"
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/tvAdd
revid: 378319
updated: 2026-04-02T16:17:41Z
---

# tvAdd

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

## Description

Adds an item with given text to Tree View control. The position on Tree View where to add the item and the actual path to this item once added are different. If item is added to existing item, then parent item path is used. If no parent exists, empty array [] is used. See [Tree View Path](../topics/Tree_View_Path.md) for more information.

## Syntax

### Syntax 1

```sqf
tvAdd [idc, pathParent, text]
```

**Parameters:**

- `idc`: [Number](../topics/Number.md)
- `pathParent`: [Tree View Path](../topics/Tree_View_Path.md) - parent item or [] if no parent exists
- `text`: [String](../topics/String.md)

**Returns:** [Number](../topics/Number.md) - index of the added item relative to the branch it was added to

### Syntax 2

```sqf
control tvAdd [pathParent, text]
```

**Parameters:**

- `control`: [Control](../topics/Control.md)
- `pathParent`: [Tree View Path](../topics/Tree_View_Path.md) - parent item or [] if no parent exists
- `text`: [String](../topics/String.md)

**Returns:** [Number](../topics/Number.md) - index of the added item relative to the branch it was added to

## Examples

### Example 1

```sqf
_index = _ctrl tvAdd [[], "Parent Item"];
```

### Example 2

```sqf
_index = tvAdd [101, [0], "First item"];
```

## See also

[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) · [tvSetCurSel](../commands/tvSetCurSel.md) · [tvSetData](../commands/tvSetData.md) · [tvSetValue](../commands/tvSetValue.md) · [tvSort](../commands/tvSort.md) · [tvSortByValue](../commands/tvSortByValue.md) · [tvValue](../commands/tvValue.md) · [tvText](../commands/tvText.md) · [tvSetText](../commands/tvSetText.md) · [tvSetPicture](../commands/tvSetPicture.md) · [tvSetPictureColor](../commands/tvSetPictureColor.md) · [tvSetPictureRight](../commands/tvSetPictureRight.md) · [tvSetPictureRightColor](../commands/tvSetPictureRightColor.md)

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