{"name":"tvAdd","operator":null,"title":"tvAdd","type":"command","url":"https://community.bistudio.com/wiki/tvAdd","revid":378319,"updated":"2026-04-02T16:17:41Z","groups":["GUI Control - Tree View"],"status":"ok","replaced_by":[],"games":[{"game":"arma3","name":"Arma 3","version":"0.74"}],"since":{"game":"arma3","name":"Arma 3","version":"0.74"},"arma3_since":"0.74","branch":null,"locality":{"argument":null,"effect":null,"server_exec":false},"exec":null,"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 for more information.","syntaxes":[{"syntax":"tvAdd [idc, pathParent, text]","since":null,"effect":null,"exec":null,"params":[{"name":"idc","type":"Number","optional":false,"default":null,"description":null,"types":["Number"],"since":null,"text":"idc: Number"},{"name":"pathParent","type":"Tree View Path","optional":false,"default":null,"description":"parent item or [] if no parent exists","types":["Tree View Path"],"since":null,"text":"pathParent: Tree View Path - parent item or [] if no parent exists"},{"name":"text","type":"String","optional":false,"default":null,"description":null,"types":["String"],"since":null,"text":"text: String"}],"returns":{"type":"Number","types":["Number"],"description":"index of the added item relative to the branch it was added to","text":"Number - index of the added item relative to the branch it was added to"},"form":"unary","operator":null,"left":null,"right":{"text":"[idc, pathParent, text]","types":["Array"]}},{"syntax":"control tvAdd [pathParent, text]","since":null,"effect":null,"exec":null,"params":[{"name":"control","type":"Control","optional":false,"default":null,"description":null,"types":["Control"],"since":null,"text":"control: Control"},{"name":"pathParent","type":"Tree View Path","optional":false,"default":null,"description":"parent item or [] if no parent exists","types":["Tree View Path"],"since":null,"text":"pathParent: Tree View Path - parent item or [] if no parent exists"},{"name":"text","type":"String","optional":false,"default":null,"description":null,"types":["String"],"since":null,"text":"text: String"}],"returns":{"type":"Number","types":["Number"],"description":"index of the added item relative to the branch it was added to","text":"Number - index of the added item relative to the branch it was added to"},"form":"binary","operator":null,"left":{"text":"control","types":["Control"]},"right":{"text":"[pathParent, text]","types":["Array"]}}],"examples":[{"text":"```sqf\n_index = _ctrl tvAdd [[], \"Parent Item\"];\n```","code":["_index = _ctrl tvAdd [[], \"Parent Item\"];"]},{"text":"```sqf\n_index = tvAdd [101, [0], \"First item\"];\n```","code":["_index = tvAdd [101, [0], \"First item\"];"]}],"multiplayer":null,"problems":null,"aliases":[],"see_also":["tvClear","tvCollapse","tvCount","tvCurSel","tvData","tvDelete","tvExpand","tvPicture","tvSetCurSel","tvSetData","tvSetValue","tvSort","tvSortByValue","tvValue","tvText","tvSetText","tvSetPicture","tvSetPictureColor","tvSetPictureRight","tvSetPictureRightColor"],"notes":[],"categories":["Arma 3: New Scripting Commands","Arma 3: Scripting Commands","Command Group: GUI Control - Tree View","Introduced with Arma 3 version 0.74","Scripting Commands"]}