LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

how i can to drag and drop a file in my applciation?

can you give me example please in "vi" i'm beginner in labview i could not make it ?

0 Kudos
Message 11 of 16
(1,570 Views)

I'd like to resurrect this thread.

 

When placing a transparent path control in front of my panel, and choosing to make it visible when "mouse leave", i then can drop files from explorer to this control.

The problem is setting it invisible again. If I do this on event "mouse enter", the control will be set invis before accepting the drop and therefore value change will not occur.

If I don't set it invisible on "mouse enter" I don't know when exactly to set it invisible. I could do this in the "value change" event of the path control, but what if the user does not drop something, just moves the mouse back to the window. Then the path control will stay visible and block access to the underlying controls.

 

Any ideas?

 

Thx in advance

0 Kudos
Message 12 of 16
(1,403 Views)

On Mouse Enter, activate a flag in a shift register. On Timeout, hide the control if the flag is on, then reset the flag. Hide also on Value Change.

This technique is not perfect, however: during the timeout time, the user could get no response from the other controls. On the other hand, if the timeout time is too short you may miss the drop operation.


 

Paolo
-------------------
LV 7.1, 2011, 2017, 2019, 2021
Message 13 of 16
(1,397 Views)

That was a good idea.

I don't like to use "Timeout" so now in the "mouse enter" event i set a control "flag mouse enter" to true and with this fire the "flag mouse enter: value change" event. In this event i set the path control to invisible again (and the flag control).

The good thing with this is that the "path control: value change" event is still registered and fired after, unlike when setting the path control invisible directly in the "mouse enter" event.

 

Thx

0 Kudos
Message 14 of 16
(1,383 Views)

Check out this example.

 

https://forums.ni.com/t5/Example-Programs/Windows-Explorer-in-your-front-panel/ta-p/3492301

 

It does some fancy things with Windows Explorer, but the main idea is that once it is running, drag one of the text files from the left pane to the graph and drop it.  It will load the graph with the data from the control.  Looking at the VI you will see the transparent path control is made visible and invisible at times like mouse enter, mouse leave, and value change on the path control.  This is the simplest, but hacky solution.

Message 15 of 16
(1,368 Views)

That is also interesting.

For me, the "Path Control:Value Change" event did not fire because "Mouse Enter" would execute before and make the control invisible.

Here in the example it works just fine. It does not fire the "Mouse Enter" Event when dragging and therefore does not make the path control invisible before dropping.

 

I used "This VI:Mouse Enter". Maybe that is the difference. In the example we stay within the front panel and "Chart:Mouse Enter" is used.

 

Thx

0 Kudos
Message 16 of 16
(1,356 Views)