LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Drag & drop from explorer into my application

Solved!
Go to solution

Hi folks,

 

I want to drag files or folders from Windows explorer into a tree structure of my LabVIEW application. I did not find any solution or example (and I was not able to install the G-Toolbox, which is mentioned in some old forum boards).

Does anybody have an example? Thank you very much! 

0 Kudos
Message 1 of 6
(7,456 Views)

Hi,

Here is an exemple : you can drag a .txt file into Labview, and read it...

Best regards,

 

V-F
0 Kudos
Message 2 of 6
(7,383 Views)

Hi Ramses,

 

thank you for your reply. I know, it works by using a path control. But I want to do the same by using a tree control, but unfortunately this does not work this way.

0 Kudos
Message 3 of 6
(7,359 Views)

Hi,

 

you can use Active X to open the C:/Program Files directory. Look for the shipping example: ActiveX Event Callback for IE.vi

 

Also check this:

Windows Explorer Plugin

https://decibel.ni.com/content/docs/DOC-5674

 

Cheers,

Jannis

Message 4 of 6
(7,269 Views)
Solution
Accepted by topic author sparti

You already asked this question over at LAVA, and I even posted an example on how to do it. Please follow the threads you create.

Message 5 of 6
(7,257 Views)

I found this thread searching for a way to drag and drop files from the OS (either Windows Explorer or Mac Finder) onto my VI.  I don't want a visible file path control on the front panel--I want the user to be able to drop the file anywhere within the VI's panel.

 

I've looked at all of the examples linked above in this NI thread and the thread at LAVA, but came up empty for any code examples that does this for both Mac and Windows.  

 

I did eventually find a way to create something that works for Windows.  (I might have seen this solution from the JKI guys a few years back--I can't remember.)  It relies on the following:

 

* A transperrent path control set to "fit control to pane" so that it covers the whole pane even if it is resized.

* This path control needs to be the top-most control so that is can always receive the dropped path.

* Create a <This VI>:Mouse Enters event to make the path control inivisble

* Create a <This VI>:Mouse Exits event to make the path control visible 

 

This works in Windows (testing with LV2010 in Win7) because when you drag a file onto the VI panel it DOES NOT fire the Mouse Enters event.  You can drop the file and as soon as the path control receives the path the VI can rehide the path control so that the user can manipulate other controls on the panel.

 

However, the problem is that on Mac (tested with LV2010 in Mac Lion), the Mouse Enters event DOES fire when you drag a file into the VI panel.

 

I'm posting this example as a working example for Windows folks, but I hoping there is a clever Mac user out there than can figure out a work-around to make this work for the Mac too.

 

Thanks!

Message 6 of 6
(7,196 Views)