Jump to content

Drag and Drop onto Listbox


Recommended Posts

Hi.

   I was to drag a file from the finder onto a 'listbox' type object in a LabVIEW vi. I then want the object to display the complete path of a file. I can make a "Path" type object do this, but i do not seem able to do the same with a listbox. Does anyone know if this is possible?

Code Attached.

Drag'n'Drop-Listbox.vi

 

Many thanks, Alec

Link to comment

What is a "finder".  Do you mean you are dragging and dropping from the Windows explorer window?  If so someone posted an example on LAVA that uses some windows messaging library.

 

https://lavag.org/topic/14540-drop-into-a-tree-from-other-program/#entry87760

 

Another trick I've seen is that the path control allows you to drop files on it, so you might be able to get a path control and make it transparent, and put it over your listbox.

Link to comment

What is a "finder".  Do you mean you are dragging and dropping from the Windows explorer window?  If so someone posted an example on LAVA that uses some windows messaging library.

 

https://lavag.org/topic/14540-drop-into-a-tree-from-other-program/#entry87760

 

Another trick I've seen is that the path control allows you to drop files on it, so you might be able to get a path control and make it transparent, and put it over your listbox.

 

Whats A FINDER! Dang, you kids. (The finder is what windows explorer used to be called on the Apple Macintosh, LabVIEW also comes on Macintosh, In-fact, it was there first, Microsoft were late to the party... As usual! ;)... ). Yes, I do mean Explorer, think i had a relapse. Will check out the link, thanks.

OK, so what you are saying is that you just can't. LabVIEW does not support dragging from the desktop and dropping on it... Hmmm, rubbish.

Edited by alecjcook
Link to comment

Whats A FINDER! Dang, you kids. (The finder is what windows explorer used to be called on the Apple Macintosh, LabVIEW also comes on Macintosh, In-fact, it was there first, Microsoft were late to the party... As usual! ;)... ). Yes, I do mean Explorer, think i had a relapse. Will check out the link, thanks.

OK, so what you are saying is that you just can't. LabVIEW does not support dragging from the desktop and dropping on it... Hmmm, rubbish.

So I'm a bit confused, are you on Windows or Mac, cause you say you mean Explorer, but then said Finder which "is what windows explorer used to be called".  I believe Windows Explorer used to be called File Manager in the Windows 3.x days.

 

And what do you mean by "Dang you kids", there could be people of any age that just have never used a Mac.

 

I didn't say LabVIEW doesn't support drag and drop, I'm saying there are options for doing drag and drop from an Explorer, but none are clean, other than onto a path control.  I've seen several neat examples, like this one with dragging an image on a tab.  The source isn't available but I wouldn't be surprised if a path control just isn't on top of the image since you don't interact with the image.  

 

I believe LabVIEW doesn't have a unified way of doing this because it is cross platform, and you could be using any number of shells for any OS and supporting all of them would be a pain.  I like the idea, but I have yet to need this feature.

Link to comment

So I'm a bit confused, are you on Windows or Mac, cause you say you mean Explorer, but then said Finder which "is what windows explorer used to be called".  I believe Windows Explorer used to be called File Manager in the Windows 3.x days.

 

And what do you mean by "Dang you kids", there could be people of any age that just have never used a Mac.

 

I didn't say LabVIEW doesn't support drag and drop, I'm saying there are options for doing drag and drop from an Explorer, but none are clean, other than onto a path control.  I've seen several neat examples, like this one with dragging an image on a tab.  The source isn't available but I wouldn't be surprised if a path control just isn't on top of the image since you don't interact with the image.  

 

I believe LabVIEW doesn't have a unified way of doing this because it is cross platform, and you could be using any number of shells for any OS and supporting all of them would be a pain.  I like the idea, but I have yet to need this feature.

 

LabVIEW might support the dragging from explorer and dropping on a 'Path' control, but it does NOT support the dragging from explorer and dropping on a 'List Box'.

 

 

* "Dang You Kids" is supposed to be a light harder jove. I am british so it's not even a thing i'd say in real life. If I repeated some of the sarcasm us brits use, you really would take it the wrong way ;)

Link to comment

If I repeated some of the sarcasm us brits use, you really would take it the wrong way ;)

 

It doesn't stop me so I expect people in here are acclimatised :D

I didn't mean anything by it and didn't really take offense, sorry if it came across as hostile. (BTW I am one of those dang kids :D ) (but I also haven't used a Mac for more than 5 minutes in my life)

 

Guess how many toolkits Mac users buy? Guess how many queries I have had for installing any of my toolkits on Mac? : :lol:

Link to comment

LabVIEW might support the dragging from explorer and dropping on a 'Path' control, but it does NOT support the dragging from explorer and dropping on a 'List Box'.

 

It's possible to use the path control to do what you want, but it's a little hack-ey. You end up making the path control transparent, then only making it visible when the mouse is outside the VI's front panel. See http://digital.ni.com/public.nsf/allkb/81D867F8C6A1376D86257347001BE936

  • Like 1
Link to comment

Oh that's not that too hacky, thanks for the link a quick search didn't find that one.  I was wondering how you would hide or shot based on mouse movement.  I guess the trick is that the Mouse Enter event isn't when dragging from explorer, until you release the mouse button.

Link to comment

It's possible to use the path control to do what you want, but it's a little hack-ey. You end up making the path control transparent, then only making it visible when the mouse is outside the VI's front panel. See http://digital.ni.com/public.nsf/allkb/81D867F8C6A1376D86257347001BE936

 

And when you want it to accept dropping of multiple files you enter the next level in the world of pain :)

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.