From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

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,680 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,633 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,622 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,608 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,593 Views)