From 04:00 PM CDT – 08:00 PM CDT (09:00 PM UTC – 01:00 AM UTC) Tuesday, April 16, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to use event structure to sort listbox data?

Solved!
Go to solution

I have a VI that contains two listboxes.  Both listboxes are selectable by the user.  Here is how I want them to interact.

 

When the VI is initialized, the first listbox will be filled with data.  If the user double clicks a cell in the first listbox, the second listbox will be populated by sorting the information in the first listbox a certain way.  I don't think the details of how this data is sorted is pertainent here...  Next, I want the user to be able to double click one of the rows in the second listbox.  The element double clicked in the second listbox will be be used in another VI that will then start.

 

I've got my VI working such that the first listbox will populate the second listbox after the user double clicks a cell in the first listbox.  I'm using an event structure to do this.  Here is where the trouble starts.  I have a second event structure that listens for double clicks in the second listbox, but when I do this, the program locks up.  Additionally, I only want the user to be able to double click the second listbox if the first listbox has already been double clicked.

 

Generally, my question really revolves around how to use the event structures in this application?  Should I be using two event structures at the same time?  Is there a better way to do this?

0 Kudos
Message 1 of 7
(3,255 Views)
Solution
Accepted by topic author KSU Flyer

No, you should probably not be using two different event structures. A single one should work fine.

 

Does the subVI immediately run and return? If not and  you have the front panel locked until the event finishes, that would explain what you are seeing.

Message 2 of 7
(3,251 Views)

Dennis,

 

The subVI is called and returns directly to the main VI, with the main VI being the GUI

0 Kudos
Message 3 of 7
(3,245 Views)

Dennis,

 

I've looked at your VI, thanks for your help...

 

Can you show an example where the data from the first listbox is sorted and put into the second listbox depending on which value in the first listbox is selected?  Right now you start by puting the values from the single array into both listboxes.  In my situation, the second listbox is only populated from data directly taken from the first listbox.

 

-Mike

0 Kudos
Message 4 of 7
(3,244 Views)

No, the example does not do that. It starts by populating the first listbox and when it is double clicked, it populates the second listbox. The only thing it does not do is make sure the second listbox is empty when the VI starts. Just write an empty array to it's ItemNames property.

 

You would need to explain exactly how you want things sorted. All I did was reverse the array. It sounded from your first post, that you were already doing that.

 

Message Edited by Dennis Knutson on 01-23-2010 05:49 PM
Message 5 of 7
(3,240 Views)

Dennis,

 

Sorry, I started blabbing before I completely understood your VI.  I think you might have solved my problem.  I'm working through it now.  Stay tuned.  I truly appreciate your help, especially on a Saturday night!

 

-Mike

0 Kudos
Message 6 of 7
(3,235 Views)
Thanks again Dennis, got things working just like you showed!  Onto the next hurdle!
0 Kudos
Message 7 of 7
(3,211 Views)