LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Tree: dragged data format

Solved!
Go to solution

Hi,

 

I am dragging files & folder from one tree control to another. Unfortunately, the tags change in the process. When dropped, the new tags seem to be the values of the first cell. That is a problem because I use the tag to save the file path.

I now want to read out all the tags of the dragged/dropped data to overwrite the automatically generated tags with the original ones. If I cannot use the same tag I could easily add a constant or something like that. That would also allow me to easily check if the selected tags have already been dropped and discard this event to prevent duplicate files.

 

I tried to read the tree data in the "Drag Starting?" event but cannot figure out how to get anything useful from the variant data. I saw the LV examples but that was not very useful to me. Basically, I am just trying to read the "LV_TREE_ITEMS" as a string, array of strings or something like that. I found info of what the format should be (Manual: 'Array of a cluster containing an array of strings, from left to right, in the item you are dragging, an integer representing the glyph index associated with the item from which you are dragging data, and an integer representing the indent level of the item from which you are dragging.') but was not able to use that information for the "Variant To Data" VI.

I am not used to the variant data type very much.

 

Any help is appreciated. I saved an example for Labview 14.

thanks!

 

Flumen

0 Kudos
Message 1 of 8
(2,884 Views)
Solution
Accepted by topic author Flumen

Here is the data type you need.

"If you weren't supposed to push it, it wouldn't be a button."
0 Kudos
Message 2 of 8
(2,873 Views)
Solution
Accepted by topic author Flumen

...after trying it for quite some time and almost giving up I figured it out right after I posted the above message.

 

I just used the wrong input to transform the variant data to what I needed. By going through the XML file I found the correct format, which is:

- Array of a cluster

- the cluster has 3-elements:   1D-string array, I31, I32

 

Unfortunately, is does not give me the tag as I hoped. But I can find the tags using the information.

I attached the solution

0 Kudos
Message 3 of 8
(2,872 Views)

Thanks!

 

Just figured it out myself. We probably posted at the same time. 🙂

0 Kudos
Message 4 of 8
(2,870 Views)

In the future, you might find this handy.

"If you weren't supposed to push it, it wouldn't be a button."
0 Kudos
Message 5 of 8
(2,824 Views)

Thanks. Looks like it automatically creates the control you need based on the input data type, correct?

I am not sure how to use it, could you explain that in 1-2 sentences, please? I am sure I can figure the rest out myself.

0 Kudos
Message 6 of 8
(2,818 Views)

v2c.jpg

"If you weren't supposed to push it, it wouldn't be a button."
0 Kudos
Message 7 of 8
(2,805 Views)

I obviously tried that before but must have done something wrong when copying the data format.

 

Works now, thanks!

0 Kudos
Message 8 of 8
(2,792 Views)