Academic Company Events Community Support Solutions Products & Services Contact NI MyNI
4 ratings:
 3.75 out of 5   

How Can I Make Any LabVIEW Control Capture the File Path From a Drag-and-Drop?



Primary Software:
Primary Software Version: 1.0
Primary Software Fixed Version: N/A
Secondary Software: LabVIEW Development Systems>>LabVIEW Full Development System

Problem:
I want my picture ring control to behave like the file path control, accepting drag-and-drops from outside of LabVIEW during runtime. Even though the control would not display the path text, I would like to secretly capture the path so I can effectively read and edit the file elsewhere in my program. Is there any way to do this?

Solution:
Since there is no direct property for this, you will need to implement an event-driven solution that seamlessly uses an invisible file path control.

See the attached example program that demonstrates this functionality.



The front panel of the VI has a file path control sized just inside a picture ring. It is completely invisible but still the active control by default. If the ring area receives a drag-and-drop, the Captured Path indicator updates but the ring area appears unchanged. If the mouse enters the ring area without dragging an object, the path control effectively goes to the back, thereby enabling the picture ring for image toggling. Finally, if the mouse leaves the ring area, the path control resurfaces so that it can accept another drag-and-drop.

This methodology could apply to any control, not just the picture ring.

Related Links:
Developer Zone Example: Drag and Drop Files into LabVIEW

Attachments:
Drag-n-Drop_FilePath_to_AnyControl.vi




Report Date: 08/30/2007
Last Updated: 04/02/2014
Document ID: 4CTD5LO

Your Feedback! poor Poor  |  Excellent excellent   Yes No
 Document Quality? 
 Answered Your Question? 
  1 2 3 4 5
Please Contact NI for all product and support inquiries.submit