LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Inserting an image in a column of a multicolumn listbox

Hi,

How can I insert an image in a column and row of a multicolumn listbox? Is it possible?

Thanks,

ToNi.
0 Kudos
Message 1 of 13
(5,636 Views)
To my knowledge, there is no way to do that directly since a list box handles only text. A workaround could be to overlay the pictures on the listbox. There are a few issues : if you put the picture over the listbox, you will not be able to select the underlying listbox row; if you put it under(making the listbox transparent of course), the picture will be hidden when selected.
A more involved solution is to overlay an array of picture controls, and to detect the mouse clicks and pass them to the listbox below, as in the attached vi

Enjoy...

CC
Chilly Charly    (aka CC)
Message 2 of 13
(5,611 Views)
Hi,

I can not open it. You attach me a LV 7.1 version of your vi... and I have LV 7.0 Express. Can you attach a LV 7.0 version of it?

Thanks very much for helping me 😉

ToNi.
0 Kudos
Message 3 of 13
(5,593 Views)
Here it is...
CC

Message Edited by chilly charly on 04-28-2005 08:52 PM

Chilly Charly    (aka CC)
Message 4 of 13
(5,577 Views)
Hello,

This is a good idea but now... I need to know how to change the foreground of a column of the multicolumn listbox (not for all columns of my multicolumn listbox, I only want to change the foreground color of the columns I am interested in) so the values are not visible when I insert them and then I put the image over.

My second problem is to know how to put an image in RUN TIME in the row and column of my multicolumn listbox I am interested in. Because at the beginning, before running my vi, I don't know how many rows my multicolumn listbox has. It is not static and then at the beginning I can not create the array of images.

Thanks,

ToNi.
0 Kudos
Message 5 of 13
(5,564 Views)
Hi,

there is another problem. What's happens if in run time the user press vertical scrollbar of the multicolumn listbox? If the user press the scrollbar I want to display in the next row the next image. I don't know if you understand me.

I have a multicolumn listbox and in each column I have an array of ring with your images, and in run time the user can add rows to that multicolumn listbox. Each time the user adds a rows, for each column, I add a ring with your images to the corresponent array and I make it visible.

Your solution is perfect if the number of the multicolumn listbox is static, but if it changes in run time.... there is a problem.

Thanks,

ToNi.
0 Kudos
Message 6 of 13
(5,547 Views)
You are going to have to track the top left cell (property node) of the table and adjust the picture array indexes appropriately if you want the pictures to track with the table.

I have been watching this thread because I am interested in tha answers to hard questions.

I do not know if the attached is useful but offer it as an alternative that may be handy.

In it I use an array container that has been customized such that the array index control has been replaced with a slider.

The array container is then filled with a cluster that gives me the option to mix data types.

Please excuse me for not documenting the diagram!

Ben
Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
Message 7 of 13
(5,538 Views)
Sticking to the idea of control overlay, a scroll of the listbox can be managed with some play on property nodes, using the top left property of the listbox and the index vals of the Picture array.

CC
Chilly Charly    (aka CC)
Message 8 of 13
(5,517 Views)
To change any property of a cell, you must first select it using the Active Cell Property node, a cluster of row and column indexes. Setting the indexes values to -2 select the entire row/column/table, including the headers, setting the indexes to -1 select only the headers.
Changing a column foreground color without affecting the header color is therefore a 3 steps operation :
- set the active cell property to -1, n (n being he column index); read the foreground color
- set the active cell property to -2, n; write the new foreground color
- set the active cell property to -1; write back the previously read foreground color

Since you cannot change programmatically the images in a ring, the pict ring array cannot be used if you want to load new images at run time.
Use instead a picture array, as shown in the attached vi. I still use a pict ring, but that's just as a convenient image source. Replace it with your own source (file dialog for instance...)

CC
Chilly Charly    (aka CC)
Message 9 of 13
(5,335 Views)
Thanks Ben, your idea is very good.I try to implement later.

Chilly, how can I insert a ring in the picture array in run time without the items inserted go outside the multicolumn listbox? I attach you a vi. I have modified yours. I added my update in the timeout event.

Thanks,

ToNi.
0 Kudos
Message 10 of 13
(5,506 Views)