LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

combo box displays value instead of label

I have several combo boxes on a vi that will occasionally start displaying the value of an certain items instead of the string label when an element is selected. The only way to fix it is to deleted the combo box and replace it with another. This has happened several times on the same vi. Sometimes it is ok when the vi is run in the IDE but shows up in an executable. Is this a bug?

Thanks,
Bill F
0 Kudos
Message 1 of 15
(4,527 Views)
I don't use comboboxes (prefer enums), but this definitely doesn't sound right to me. As I understand it, a combo box should display only the labels. Do you have any property nodes in your code controlling the labels and values? Maybe you should post a piece of code where this happened.

___________________
Try to take over the world!
0 Kudos
Message 2 of 15
(4,513 Views)
Hello Bill,

I've seen this. It happened to me when I was pointing to a value non existent in the combo box.
Check the annex vi.
First I set a list of Five elements to the list and select number 4, then if you press the button, you'll see the the index is being showed in the combo, because element 4 is now non existent.

Hope this helps,
Paulo.
0 Kudos
Message 3 of 15
(4,501 Views)
Sorry, forgot the attachment...
0 Kudos
Message 4 of 15
(4,501 Views)
I think this is to be expected. Your control will have a value with no associated text.

It would be much more dangerous if LabVIEW would randomly change (e.g. coerce) the value when the strings array gets shorter by some mechanism. 😉

You have several possibilities, for example:

(1) Check the value and coerce to the highest valid entry or switch to entry zero.
(2) Keep the array of strings at constant size, but replace the unwanted entries with empty strings (see attached), the string "out of range", "invalid selection", or similar.
0 Kudos
Message 5 of 15
(4,493 Views)
Thanks, but this is different from what I am seeing. This isnt a case of the current value being set to a no-longer existent index. The item is in the dropdown list - you can click on the down arrow and select it. When you select the item, the combo box displays the value rather than the label. I have the values set to the index number of the list (why dont combo boxes have an index property?) i.e first item is 0, second is 1 etc. When I select the third item in the list, the combo displays "2"

It never occurred to me to use enums to do this (experience counts!). If I cant get an answer to this, maybe I will replace the combo boxes with enums...

Bill F
0 Kudos
Message 6 of 15
(4,493 Views)
Can you post your code?
It will be easier to help you then.
0 Kudos
Message 7 of 15
(4,488 Views)
OK,
I have attached an executable that displays this probelm - the problem doesnt appear when running in the IDE. When creating this, I notice that the index which is bad has changed from 2 to 6.

Run the exe, allow the SNA ini to complete, you will see a few errors. After it is complete, select the 7th item in the Cable Designation combo box (FWD IFB LOWER). When I do this the combo displays "6" instead of "FWD IFB LOWER"

Bill F
0 Kudos
Message 8 of 15
(4,481 Views)
It didn't happen to me on that particular item, but it happened on item number 9.
There were some errors being displayed when I changed the value on the combo box. Are you sure you are not programaticaly changing the labels of the combo box?
With a exe, instead of the vi itself, the only conclusion I can take is that my first guess (the <6>) is not right... further than that I cannot help you more.
0 Kudos
Message 9 of 15
(4,477 Views)
I am programmatically loading the strings[] and values[] at runtime, but you saw what happens. When you select the ninth item with a string label of "FWD BITE LOWER", the box displays "9". I cant think of anything one could do with properties or whatever to cause this to happen. Now we see the probelm is different on different machines. The error is on the 6th item when I run it and the 9th item when you run it. ?!?! Every time I recompile, the error shows up on a different index. I dont see how this can be anything other than a LV bug.

Is NI out there?

Bill F
0 Kudos
Message 10 of 15
(4,476 Views)