LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to polpulate and sort a listbox?

Hi,
I need to be able to display the status of a traffic light in a list box such that each entry will have a color LED (3 different colors possibly, thus it needs to be able to change during run time) and a string associated with it. What do I need to use to accomplish this, multicolumn box? And how can I sort a listbox, such that when the user clicks sort it will sort (by alphabet for example?)? Any ideas will be appreciated
0 Kudos
Message 1 of 3
(3,302 Views)
You can sort a list box using the "Item Names" property of the listbox property node. Item names returns an array of listbox strings which you can sort and then update a writable version of item names. For colors, browse around the other listbox property nodes for an answer.

Hope this helps. W. Brown
0 Kudos
Message 2 of 3
(3,302 Views)
Hello,

To answer the question about sorting, you can use the Sort 1D Array function in the Array subpalette to sort an array of strings alphabetically. The Sort 1D Array function will not, however, intersperse capital and lowercase strings together...you will get all the capital words sorted, then all the lowercase words sorted after the capitals. If you want a true alphabetical sort, you can visit the NI Developer Zone (www.ni.com/zone) and search for "alphabetically", and you will find an example VI entitled "Alphabetically Sorting Arrays of Strings", which I posted recently.

I hope these suggestions help. Have a nice day.

Sincerely,
Darren N.
NI Applications Engineer
0 Kudos
Message 3 of 3
(3,302 Views)