Academic Company Events NI Developer Zone Support Solutions Products & Services Contact NI MyNI
This Document is not yet Rated  Rate this Document

How Do I Keep the Natural Drag and Drop Ability of a Listbox and Handle a Drop Event?

Primary Software: LabVIEW Development Systems>>Professional Development System
Primary Software Version: 7.1
Primary Software Fixed Version: N/A
Secondary Software: N/A

Problem:
I have a program where I am trying to handle a drop event for a listbox that is on the front panel of the VI while I am trying to also handle a drop event for the same listbox. When I run the program, I notice that the normal dragging and dropping that I can typically do with a listbox does not appear to function like it used to. Why do I see this behavior and what can I do to get around it?


Solution:
When handling a drop event for a listbox in a VI, this overrides the natural dropping ability that is inherent with a listbox. Now, trying to drop like you normally would in the listbox will result in whatever behavior that you specify when you have the event structure handling the drop event.

There is not a way to get around this particular behavior because of the fact that handling the drop event overrides the typical ability of a listbox, but there are other methods to try and implement some of the same functionality. For example, if you are dragging from a different item on the front panel to the listbox, then you can try to use the Drag Ended event for the other item to trigger an event. This will allow you to keep the natural dragging and dropping ability of the listbox in the VI.

Note: This method will fire an event any time that a drag ends when it is started from the other item. If the data is dropped on any part of the front panel at all, the event will still be fired.  A way to possibly get around this would be to use a case structure within the Drag Ended event that would use the Result Event Data node as the case selector for the case structure.  For the Drop Cancel case of the structure, which indicates that no target accepted the data, the case could be left empty.  The figure below demonstrates this concept:
 


Related Links:
LabVIEW 8.5 Help - Get Drag Drop Data


Attachments:





Report Date: 04/16/2008
Last Updated: 05/12/2008
Document ID: 4KFHQS20

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