07-14-2015 10:02 AM
I'm trying to change the number of items shown in one of my comobo boxes.
I have been through the help and this forum and have the values within the combo box changing just fine, but in one scenario I want to go from three options to 2. Then depending upon other choices back to 3.
I'm assuming that I need to use a property node but I can't figure out which one.
Solved! Go to Solution.
07-14-2015 10:15 AM - edited 07-14-2015 10:16 AM
You can use the Strings and Values [] property if you need to change the options and their custom values or just the Strings [] property if you don't need custom values.
The input for Strings [] is just an array of options you want the user to have.
http://zone.ni.com/reference/en-XX/help/371361L-01/lvprop/combobox_strings/
07-14-2015 10:29 AM
Thanks Jacobson, but that only shows me how to change the content of each string.
I have a combo box with 3 values that I am settinging using the Strings[] property, however I want to limit this to two values depending on other variables.
Currently it is populated with
EN960:2006 525
EN960:2006 555
EN960:2006 585
I want to change this to
ISO/DIS A
ISO/DIS C
using the Strings[] property yields the result
ISO/DIS A
ISO/DIS C
EN960:2006 585
i.e. the thrid value is left untouched so I need to change the number of options.
07-14-2015 10:42 AM
Can you attach a simple VI that you are using that demonstrates this behavior?
I was able to use a control to write an array of two elements to a combo box with three options and it removed the third.
07-14-2015 10:49 AM
Thanks, the .vi is attached.
There are three combo boxes
The content of the 'headform' box depends upon the selection in the 'Standard' and 'Type of test' boxes.
07-14-2015 11:29 AM
1. That height property does not do what I think you are hoping it does. Might as well just get rid of it.
2. You really should be using an Event Structure here.
3. I'm not seeing the behavior you are describing. When writing to the Strings[] property, it is replacing the entire array for me. Or the problem could be coming from if the current value was the third option. You might want to just set the value to the first option when writing new options to the combo box.
07-14-2015 12:55 PM
Your string arrays have more elements than you think. You have hidden some of the elements by shrinking the size of the array display on the block diagram, but this does not make the extra elements go away. You have to delete the unwanted elements by right clicking on each one, then pointing to "Data Operations", then choosing "Delete Element".
07-14-2015 03:25 PM
07-15-2015 03:43 AM
Thanks for the pointers guys, I'll have a play and let you know.
07-15-2015 03:57 AM
Thanks Crossrulz.
You are right that I'm probably not using the most effiecient structures, however at the moment I am just trying to get something that works. Over the coming months I will be scaling this up to deal with dozens of standards, test types and dozens of headform combinations, I'll look at making it more elegant once I have better understanding of how LabView actually works.
Cheers