LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Read the position of a mouseclick from a multi-column list box.

Can I read the position of the mouseclick on a multi-column list box ? I want to be able to click on a cell of an MCL and read the contents of the cell that was clicked on .
0 Kudos
Message 1 of 4
(4,460 Views)
Unfortunately, there is not a quick and easy way to this; however, it can be done. You will need to use an event structure in LabVIEW 6.1, which gives the coordinates of where you clicked. You can also use the property node of the multicolumn listbox to figure out its position and cell size. Using these values you can figure out which column was clicked on. If you wire the multicolumn listbox terminal to a digital indicator, you will see that it gives the row value. You can use these row and column values then to find out the value inside the multicolumn listbox.

I have attached some sample code that demonstrates this.

Thanks,
Faya Peng
Message 2 of 4
(4,459 Views)
Reading the cell of a text table is easy, even finding out what element of an array is not a bit deal....but it's quite difficult with the multicolumn listbox. To do that you would have to read the coordinates of the mouse click and relate that to the position of each cell..it would be an inflexible solution. So I would either use a table or a text array instead....OR an array of listboxes (then check for value changes, the element changed is the column index, the value of the element is the row index...).

This whole issue has been discussed earlier on:
http://exchange.ni.com/servlet/ProcessRequest?RHIVEID=101&RPAGEID=135&HOID=5065000000080000009B350000&UCATEGORY_0=_49_%24_6_&UCATEGORY_S=0&USEARCHCONTEXT_QUESTION_0=Multicolumn+listbox+cell+selected&USEARCHCONTEX
T_QUESTION_S=0

If you want to use an array check out the following thread:

http://exchange.ni.com/servlet/ProcessRequest?RHIVEID=101&RPAGEID=137&HOID=5065000000050000006CE00000&HTHREAD=000057452&UCATEGORY_0=_49_%24_6_&UCATEGORY_S=0

Mads
0 Kudos
Message 3 of 4
(4,459 Views)
Faya Peng,
I have the same problem than jpday.
I had the same idea to make a vi like your MCL_Click.vi, but a met a problem, if a column is resized the value "cell width" stay the same for every columns. And we do not obtain the real value after clicking on a cell, is someone have an idea to get the real width size for each column?

Strangel
Technologist in physics
0 Kudos
Message 4 of 4
(4,381 Views)