LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Is there any way to get file drag events on a File Path control?

[cross-post]

I want to be able to detect that a user has draged a file into a path control, before they actually drop it. I can get the drop event, via that Value Changed event for the path control, but I need to know about the file path before they actually drop it (i.e., drag enter/over). Is there any way to do this? Perhaps by using some Windows API functions?



Thanks,

-Jim
0 Kudos
Message 1 of 10
(3,744 Views)

Hi Jim,

Thanks for the post. I researched on your issue using different combinations of VI, pane, and path control event and was unsuccessful in getting an event to fire when the drag starts outside of the LabVIEW window. I think you are on the right path with using a Windows API, which then could be interfaced into LabVIEW using ActiveX or .NET containers. If you are able to detect it, then you can use a user event to fire a drag start in LabVIEW. This should then allow you to successfully fire a drag over event. The NI Developer Zone article below will get you started on creating and using user events:

Using Dynamic Event Registration to Watch for User Inaction With a Control

Hope this helps to get you started on the right path. Have a good evening!

Cheers,

Jonah
Applications Engineer
National Instruments

Jonah Paul
Marketing Manager, NI Software
0 Kudos
Message 2 of 10
(3,697 Views)
Jim,

I don't know if this is a dead end, as I don't have time to go through it right now, but it appears you can do this in .NET:

http://msdn.microsoft.com/en-us/library/ms742859.aspx


0 Kudos
Message 3 of 10
(3,688 Views)


@jpaul wrote:

Hi Jim,

Thanks for the post. I researched on your issue using different combinations of VI, pane, and path control event and was unsuccessful in getting an event to fire when the drag starts outside of the LabVIEW window. I think you are on the right path with using a Windows API, which then could be interfaced into LabVIEW using ActiveX or .NET containers. If you are able to detect it, then you can use a user event to fire a drag start in LabVIEW. This should then allow you to successfully fire a drag over event. The NI Developer Zone article below will get you started on creating and using user events:

Using Dynamic Event Registration to Watch for User Inaction With a Control

Hope this helps to get you started on the right path. Have a good evening!

Cheers,

Jonah
Applications Engineer
National Instruments




Hi Jonah,

Thanks for your efforts in confirming my results.  I'd prefer not to use any activex or .net containers, since this will make the code extremely coupled to a specific platform.  If I can find a way to do this, using window handles or something, via WinAPI that would be preferable, because I could use a conditional disable structure to comment out the code on non-windows machines.

If anyone has any ideas about how to receive these events, using window handles and messaging, that would be great.

Thanks,

-Jim
0 Kudos
Message 4 of 10
(3,683 Views)
Google can be your friend.

Here is a VB example written in 6.0:

http://www.dutchthewiz.com/vb/api/vbDragFNames-a.zip


0 Kudos
Message 5 of 10
(3,672 Views)
Thanks Matthew,

I gave that example a try.  I wasn't able to make it work -- it wasn't catching the drop event.  Also, I'm not really looking to catch the drop event, but rather, the drag (over) event.  Presumably, the source code for this example might be a good hint about how to implement a custom ActiveX DLL that does what we want.  However, that's not really my cup of tea.  I don't mind calling into WinAPI, but I'd hate to have to put on a C++ or VB hat, in order to solve this problem.

Thanks,

-Jim
0 Kudos
Message 6 of 10
(3,613 Views)
I found a few c examples via that Google search, too.  This one has the DragEnter Method supported:

http://dn.codegear.com/article/26545



0 Kudos
Message 7 of 10
(3,605 Views)


@Matthew Kelton wrote:
I found a few c examples via that Google search, too.  This one has the DragEnter Method supported:

http://dn.codegear.com/article/26545





Thanks! (BTW, I'm not much of a C guy either.  I tend to think in g 😉
0 Kudos
Message 8 of 10
(3,603 Views)

Hi Jim,

When I opened the VI downloaded from here, whose link was originally mentioned here, I got this warning message. Smiley Indifferent

Can you please explain what ill effects it would have caused to my LV IDE?

I didnt proceed any further.

- Partha ( CLD until Oct 2027 🙂 )
0 Kudos
Message 9 of 10
(3,598 Views)
Jim,

Me neither.  But I couldn't find LabVIEW code that did it.  I figured the example would give you examples of the Windows API used to do it.
0 Kudos
Message 10 of 10
(3,576 Views)