LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Detect of drag in VI.

Hi,
How labview can detect if the mouse is dragging a file in VI or not befor to drop it in the path?
Thank you .

0 Kudos
Message 1 of 5
(2,685 Views)

I'm not sure I understand your question completely.  If a file path control has "Allow Dropping" enabled, you should be able to drag a file from anywhere and drop it in the path control and the path to that file will be updated in the control.  If you want to catch the drop before the path to the file is populated, use an event structure and register a Drop event on the control.  You can use this to, for instance, check the file extension and filter out unwanted files.  Do this by wiring a false constant to the Accepted? terminal in the Drop event. 

aputman
------------------
Heads up! NI has moved LabVIEW to a mandatory SaaS subscription policy, along with a big price increase. Make your voice heard.
0 Kudos
Message 2 of 5
(2,638 Views)

For some reason, this doesn't work as I would expect.  Enabling the option to "Allow Dropping" works and lets me drag a file and update the path, but the Drop filter event is not firing.  I'm still on Labview 2012 so maybe this has changed in newer versions.

aputman
------------------
Heads up! NI has moved LabVIEW to a mandatory SaaS subscription policy, along with a big price increase. Make your voice heard.
0 Kudos
Message 3 of 5
(2,627 Views)

Just tried in 2015.  Allow Dropping works but the drop filter event did not fire.

Drop Filter.png

Drop Filter Event.png

LabVIEW Pro Dev & Measurement Studio Pro (VS Pro) 2019 - Unfortunately now moving back to C#, .NET, Python due to forced change to subscription model by NI. 8^{
0 Kudos
Message 4 of 5
(2,613 Views)

Turning off dropping doesn't allow you to drag a file into the control, as expected.  So this does seem to be a valid drop action.  Only the Drop event doesn't fire.

 

Seems like a bug to me.  

aputman
------------------
Heads up! NI has moved LabVIEW to a mandatory SaaS subscription policy, along with a big price increase. Make your voice heard.
0 Kudos
Message 5 of 5
(2,598 Views)