LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Can I drag and drop multiple items on the Tree Control

For the drag and drop feature, I need to be able to drag multiple items (lets say all the children from one parent) and drop them underneath another parent.  So far I can see how to select multiple items, but not how to drag them.  Any idea how to do this?

Thanks

0 Kudos
Message 1 of 8
(4,146 Views)
There is not a built-in capability to drag and drop multiple items in a tree control in LabVIEW, but you can implement it programmatically if you need this behavior during run time (as opposed to edit time). I have attached some code that illustrates how to do this in LabVIEW 8.0. I chose LabVIEW 8.0 because control over drag/drop operations has been expanded in this version and is the most robust. After glancing over the functionality in LabVIEW 7.1, I believe that a similar concept could be implemented there. I will leave the conversion (or improvement) of this VI in 7.1 as a challenge to everyone else in the forum. First one that can figure it out gets a 5-star rating ;)
 
Kind Regards,
E. Sulzer
Applications Engineer
National Instruments
0 Kudos
Message 2 of 8
(4,131 Views)
AESulzer, this looks like it would be exactly what I'm looking for, but I don't see the attachment. Do you mind uploading it again?

Thanks,
Chris
0 Kudos
Message 3 of 8
(4,036 Views)
Hi Chris,
 
Though I'm not sure what AESulzer may have come up with, I tried playing with this a little myself. I attached some code below in 8.0 format which demonstrates how you can drag multiple children from one tree to another. There are probably several ways you could accomplish this, and mine may not be the best. Regardless of what you want to do in your specific application, I think the key is using the "Point to Row Column" method of the tree control to know where to insert your new items. Be sure to check out some of the example programs for dragging & dropping too if you haven't tried this before. You could probably implement similar functionality with an X Control if you don't want all this on your block diagram.
 
Hope this helps!
Charlie S.

Visit ni.com/gettingstarted for step-by-step help in setting up your system
0 Kudos
Message 4 of 8
(4,010 Views)
Hi Charlie,
Can you explain why the example can't run in LabVIEW 8.2? Thanks.
 
Ancle
0 Kudos
Message 5 of 8
(3,946 Views)
Sorry, I mean it can't drag from tree into another.
 
Ancle
0 Kudos
Message 6 of 8
(3,938 Views)
Hi Ancle,
 
I tried running the simple example I attached above in 8.20. It appears to work fine. Are you dragging a child from a parent from "Source Tree" to a parent in "Destination Tree"? Perhaps I am missing something - could you explain where it's breaking?
 
Thanks!
Charlie S.

Visit ni.com/gettingstarted for step-by-step help in setting up your system
0 Kudos
Message 7 of 8
(3,926 Views)

Hi Charlie,

The example I tried is working fine, but why should I must press "Shift" and mouse at same time just can drag childs.

Sorry about my English. Thank you.

Ancle

0 Kudos
Message 8 of 8
(3,916 Views)