06-15-2011 04:36 PM
I'm having trouble figuring out the correct way to move an item and its children from one location in a tree to another programmatically. There is the "Move Item" method, but this only takes a parent tag. I need something like the Move Item method, but instead it would take a "Previous Item" tag.
I can probably accomplish this by clearing out and repopulating the tree after an item has been dropped, but the user can see the tree repopulating which isn't ideal, and I have to reestablish the item symbols, etc.
06-15-2011 07:33 PM
I am not sure if I understand you correctly, but I don't see why you want a previous tag? Perhaps we have different versions of LabView. I am using 2010 and it has the Move Items Method. The method takes a parent tag (the new destination), and a tag (the source tag) and moves the source tag to the new parent as a child.
Additionally you can set the carry child terminal to true to move all of the children under the source tag with it (I think this is what you are looking for). There is also a new position terminal that allows you specify the exact placement of the source item under the new parent.
Hope this helps if you haven't already found the solution.
06-16-2011 03:59 PM
Yup you're right. I mistook the "New Position" parameter for the indentation level parameter in other Edit Tree methods. Should have read the documentation in more detail. Got my tree control in top shape now thanks! 🙂
PS - Of all the controls, I've found that generally working with the tree control has been one of the more challenging and time consuming tasks in my application. In order to get the tree control to do anything substantial (i.e. working more like a Windows File Explorer tree) requires a fair amount of complicated algorithmic work for manipulating the tree, adding drag-and-drop functionality, and keeping the tree items in sync with other items in my application.