Tree View Path – Arma 3
Tree View path for referencing Tree View item is not the same as the path used for adding items to the Tree View. This may cause quite a bit of confusion as to the usage of the Tree View commands. In short, when adding new items to the Tree View, one needs to give the path of the parent item to which the item is added and not the desired path for the new item. The command will then return index of added item relative to the parent item. If parent item doesn't exist (happens when item is added to the main trunk of the tree), the parent path needs to be empty array [].
This is only relevant to the tvAdd command. All other Tree View commands reference the actual item path. So here are 2 examples for tvAdd and tvDelete:
As you can see, the parent item path is referenced in each tvAdd command. Let's look at tvDelete. The item path will be the actual path to the item.
The reason "Item1_2" is not deleted is because its path changed from [0,1] to [0,0] after we deleted "Item1_1".
Now "Item1_2" is also deleted because the path for it is now correct. Here is a diagram to help to understand Tree View better:
The code used to generate the above Tree View: