To download NI software, including the products shown below, visit ni.com/downloads.
Overview
This example shows how to sort a multicolumn listbox by simply clicking the column header. These are modifications of code written by user LaRisa_S (Her code is located here: MCL Sorting).
Description
This example is designed to allow the user to sort a multicolumn listbox by any of the columns just by clicking the header. The main VI uses the subVI to sort the multicolumn listbox. As seen in the main VI, to use this, the user will drop the MCL Sort By Column.vi on to the block diagram, and use an event structure to fire on the event of the user's mouse coming up while on the listbox. The MCL Sort By Column.vi will receive a reference to the listbox, and will then sort the elements either ascending or descending (based on the last click).
Requirements
Steps to Implement or Execute Code
Additional Information or References
VI Front Panel
VI Block Diagram
**This document has been updated to meet the current required format for the NI Code Exchange.**
Example code from the Example Code Exchange in the NI Community is licensed with the MIT license.
Dear all,
This code comes in handy when sorting the MCList Box. I wonder I found it now only.
But I'm not sure how many people are aware of a bug in this module.....
I found the bug when I'm running the attached Multicolumn Listbox Sort 2012 NI Verified.vi.
The bug is in the MCL Sort By Column.vi.MCL Sort By Column.vi
The bug is with the value -2.
But how ?
Get Clicked Column Header
Wait look at this pic,
MCList Box with visible Row Headers
When we click any cells in the MCList Box, that invoke node returns a value of -2 ,and it gives value form 0, 1, 2...(n-1 Columns) when we click on any Column Header.
But when we click the empty and unused column located above the Row headers,
Unused Column In MCList Box
the marked place, invoke node returns a value of -1.
If it happens, the MCL Sort By Column.vi will remove all the items from the MCLBox.
So the value -2 has to be replaced with -1.
Thank you for your kind attention .