Sorting Multicolumn Listbox by Clicking on Column Header using LabVIEW

Produtos e Meio Ambiente

Esta seção reflete os produtos e o sistema operacional utilizados para criar o exemplo.

Para baixar o software NI, incluindo os produtos abaixo, visite ni.com/downloads.

    Software

  • LabVIEW

Código e Documentos

Anexo

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

  • LabVIEW Base Development System 2012 (or compatible)


Steps to Implement or Execute Code

  1. Unzip the attached folder to your computer
  2. Open the VI "Multicolumn Listbox Sort 2012 NIVerified.vi"
  3. Run the program

 

Additional Information or References

VI Front Panel

Multicolumn Listbox Sort 2012 NIVerified Front Panel.png
VI Block Diagram

 Multicolumn Listbox Sort 2012 NIVerified Block Diagram.png

 **This document has been updated to meet the current required format for the NI Code Exchange.**

GCentral ChampionCLA

Ao enviar o código para a Comunidade NI, você concorda com as condições da licença MIT. Saiba mais sobre a Política de licenciamento de exemplo de código da NI.

Comentários
Its_Me_Ashiq(ஆஷிக்)
Member
Member
em

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.viMCL Sort By Column.vi

The bug is with the value -2.

But how Smiley surpreso ?

Get Clicked Column HeaderGet Clicked Column Header

Wait look at this pic,

MCList Box with visible Row HeadersMCList 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 BoxUnused 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 Smiley feliz .