LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Drag and Drop Listbox - Help

Solved!
Go to solution

Hello! I am back to doing some LabVIEW programming and ran into a problem that I cannot seem to solve.

 

I am trying to use dag and drop on a listbox. I have it set to move only and it works fine. The problem is that if I have a drop event the item moved just goes away. I could not find any examples or answers in the forums.

 

Anyone care to teach me about drag and drop?

 

Thanks

 

 

 

 

 

=====================
LabVIEW 2012


0 Kudos
Message 1 of 7
(6,001 Views)

If you right click the listbox to access the properties you will find under drag and drop >> drag mode you have it set for move only.

If the item is going to be "moved" then it will be deleted from the list when the drag operation is completed -- this is probably what you want.

However you have to manually add the item back into the list if you accept the drag operation.  You can find a decent example here:

https://decibel.ni.com/content/docs/DOC-19895

Message 2 of 7
(5,987 Views)

Thanks. The listbox behaves just like I want it to unless I add the drop event. I will have to figure out how to insert the items to the dropped position. It really isn't straightforward is it.

=====================
LabVIEW 2012


0 Kudos
Message 3 of 7
(5,950 Views)
Solution
Accepted by topic author SteveChandler

It is not unstraightforward.  Shift register holds the listbox value at the time of drag start (ie. the index of the item).

 

DragDropListbox.png

Message 4 of 7
(5,937 Views)

Let me start off by saying that it is really, really dumb that just adding an event case should cause the behaviour of a control to change so drastically. Having gotten that out of my system, the examples I have found using the get drag drop data vi only seem to work with single items. If I'm trying to drop multiple items (i.e. I can select multiple items in one listbox to drop in another) I can't seem to make it work. I tried using the LV_LISTBOX_ITEMS entry to the vi, but even with a probe on it, I can't discover what it is trying to return. How can I drag and drop multiple items at once?

0 Kudos
Message 5 of 7
(5,758 Views)

Hey rossu,

 

I believe that I have found something that may help.  The link below explains how to select multiple items at once.

 

http://zone.ni.com/reference/en-XX/help/371361J-01/lvhowto/setting_the_number_of_sele/

 

Also, it may help to repost this issue in a new forum since this one has been inactive for a while.  

 

Hope this helped.

Taylor
0 Kudos
Message 6 of 7
(5,718 Views)

Actually, the issue is not multiple selections but dropping multiple selections. I will repost this as you suggest along with my current solution

0 Kudos
Message 7 of 7
(5,660 Views)