02-20-2014 08:23 AM
The Problem: It is easy to drag and drop multiple selections from one listbox to another. Just left click the source and check drag and drop>allow dragging, >allow drag drop outside control and on the receiving end check drag and drop > allow dropping. Everything works the way you would think it should. The problem arises when you try to use the Drop Event. All of a sudden the dropped items do not appear in the destination box, nor are they available directly in the event structure. If Accepted is true in the event box, then the items disappear in the source but they don't reappear in the destination (small inconsistency issue there). If you are only moving one item then the get drag drop data vi can help you to recover the dropped text (there is an example). However, if you are trying to drop multiple items at once, it will only give you the first item. There is an entry to this vi called LV_LISTBOX_ITEMS, but there is insufficient information to make this work and even putting a probe on it I couldn't get it to tell me what kind of data the VI returned with this option selected. Something for the documentation guys to work on.
The solution that I have come up with is to use the Drag Starting event to copy the information to a control (or indicator) so it can be accessed later in the drop event. (See attachment). The problem of course is that this won't work if the source is not a Labview VI or, I suspect, if the source is a different form in Labview since the controls of one vi are invisible to another. Presumably I could do something with a global variable but I haven't worked that out yet. DOes anyone know how to use the get drag drop data to retrieve multiple text selections? Alternatively, does anyone out there know of a way to make the drag drop work when the source is another vi or possibly another program altogether?
02-21-2014 06:02 PM
rossu,
Hopefully some of the other gurus here can contribute to what you're looking for. I could see some potential for <how dare I> global variables. Is your code something that can be posted here for others to see or can you provide some example of it?