{"name":"tvSetCurSel","operator":null,"title":"tvSetCurSel","type":"command","url":"https://community.bistudio.com/wiki/tvSetCurSel","revid":369062,"updated":"2024-09-02T20:24:55Z","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":"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*)","syntaxes":[{"syntax":"tvSetCurSel [idc, path]","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":"path","type":"Array of Numbers","optional":false,"default":null,"description":null,"types":["Array","Number"],"since":null,"text":"path: Array of Numbers"}],"returns":{"type":"Nothing","types":["Nothing"],"description":null,"text":"Nothing"},"form":"unary","operator":null,"left":null,"right":{"text":"[idc, path]","types":["Array"]}},{"syntax":"control tvSetCurSel path","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":"path","type":"Array of Numbers","optional":false,"default":null,"description":null,"types":["Array","Number"],"since":null,"text":"path: Array of Numbers"}],"returns":{"type":"Nothing","types":["Nothing"],"description":null,"text":"Nothing"},"form":"binary","operator":null,"left":{"text":"control","types":["Control"]},"right":{"text":"path","types":["Array","Number"]}}],"examples":[{"text":"```sqf\ntvSetCurSel [101, [0]];\n```","code":["tvSetCurSel [101, [0]];"]},{"text":"```sqf\n_ctrl tvSetCurSel [0,0,0];\n```","code":["_ctrl tvSetCurSel [0,0,0];"]},{"text":"```sqf\n0 spawn\n{\n    disableSerialization;\n    _CT_TREE = findDisplay 46 ctrlCreate [\"RscTree\", -1];\n    _CT_TREE ctrlSetPosition [0,0,0.3,1];\n    _CT_TREE ctrlCommit 0;\n    _CT_TREE tvAdd [[],\"Parent_A\"];\n    _CT_TREE tvAdd [[0],\"Child_A\"];\n    _CT_TREE tvAdd [[0,0],\"Grandchild_A\"];\n    _CT_TREE tvAdd [[],\"Parent_B\"];\n    _CT_TREE tvAdd [[1],\"Child_B\"];\n    sleep 1;\n    hint \"SELECT [0,0,0]\";\n    _CT_TREE tvSetCurSel [0,0,0];\n    sleep 2;\n    hint \"DESELECT ALL\";\n    _CT_TREE tvSetCurSel [-1];\n};\n```","code":["0 spawn\n{\n\tdisableSerialization;\n\t_CT_TREE = findDisplay 46 ctrlCreate [\"RscTree\", -1];\n\t_CT_TREE ctrlSetPosition [0,0,0.3,1];\n\t_CT_TREE ctrlCommit 0;\n\t_CT_TREE tvAdd [[],\"Parent_A\"];\n\t_CT_TREE tvAdd [[0],\"Child_A\"];\n\t_CT_TREE tvAdd [[0,0],\"Grandchild_A\"];\n\t_CT_TREE tvAdd [[],\"Parent_B\"];\n\t_CT_TREE tvAdd [[1],\"Child_B\"];\n\tsleep 1;\n\thint \"SELECT [0,0,0]\";\n\t_CT_TREE tvSetCurSel [0,0,0];\n\tsleep 2;\n\thint \"DESELECT ALL\";\n\t_CT_TREE tvSetCurSel [-1];\n};"]}],"multiplayer":null,"problems":null,"aliases":[],"see_also":["tvAdd","tvClear","tvCollapse","tvCount","tvCurSel","tvData","tvDelete","tvExpand","tvPicture","tvSetData","tvSetPicture","tvSetValue","tvSort","tvSortByValue","tvText","tvValue"],"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"]}