10-05-2009 09:54 AM
Hi
Is there a cvi function to sort a listbox alphabetically ?
10-05-2009 11:33 AM
Shako:
As far as I know, there's nothing built in to CVI to automatically sort the items in a list box.
If you could use a tree control instead of a list box, look at the SortTreeItems() function, and the treesort.cws project that ships with CVI.
CVI does have a Sort() function in the Analysis library to sort an array of doubles, and a qsort() function, which handles array manipulation, but you write your own comparison function for it. See the CVI help for both functions. To use either function with a list box, you would need to read your label/value pairs into array, sort the arrays, and write them back out to the list box. The Analysis library Sort function will only work on the list box values, not on the labels. qsort can work on labels as well as values.
10-05-2009 05:40 PM
10-06-2009 01:07 AM
Thanks for the info.
I will be creating my own sorting function.