Showing results for 
Search instead for 
Did you mean: 

Changing combo-box contents programmatically

Hi, Everybody --


We use a camera in our lab for data collection, and it has three interchangeable lenses.  Each lens has a different set of apertures that can be used; each aperture is identified in the camera by a corresponding sequential number.  For instance, f/1.8 is represented by 1, f/2 by 2, f/2.8 by 3, etc., until all of the available apertures are covered.  Each lens has its own particular set of apertures that it supports, so there are three sets of aperture-ID number combinations for the three different lenses.  When we had just one lens, selecting the aperture and sending it to the camera was done very effectively through a combo box.  Now, however, on the front panel of the camera-setup VI, I either have to use three different combo boxes for the three different lenses or a single combo box whose contents are changed after the applicable lens is selected.  To save front-panel space and (hopefully) to learn how to do something new, I'm trying the single-combo-box option.


I've been looking for solutions for this for more than a week, but I've come up empty.  I'm attaching two different subVIs that I've tried with no luck.  The first, with the suffix "array" attempts to use a method given by RavensFan to DBerry in As you can see, there's still a type mismatch between the source and the sink.  The second, with the suffix "cluster" attempts to create a 1D array of clusters of two elements, but it doesn't match the sink for the combo box when I try to use it to set up that combo box.


I'm sure I'm just not understanding something that's pretty fundamental, but the LabVIEW part of my mind has turned into mush.  I'd appreciate any instructions and/or corrections to get this working.


Thanks a million for your time!





0 Kudos
Message 1 of 4

In #1, you need to bundle into a cluster inside the For Loop, then the auto-indexing into an array will work.  (Get rid of the 2-D array indicator.)


In #2, you needed to turn that integer into a string (which you did just fine with #1.)


0 Kudos
Message 2 of 4

Thanks yet again, RavensFan.  I guess that was dumb enough to keep you shaking your head for the rest of the week. 


I still have a question or two so I can understand this, if I might.  When I got that broken wire in the main VI, the error message said that I was trying to connect a "1-D array of cluster of 2 elements" to the sink that was "typedef 'LVCombBoxStrsAndValuesArrayTypeDef.ctl' 1-D array of cluster of 2 elements."  Since the property name is "Strings and Values," and the typedef has "StrsAndValues" in its name, I assumed that the combo-box strings were strings and the values were numbers.  I spent a good chunk of time looking to find the actual structure of that typedef, but to no avail.  In my mind, I did have a 1-D array of cluster of 2 elements, but it was obviously composed of strings and integers.


The question: Is there some way to determine what a particular typedef specifies without having to bug you guys with simple questions like mine?


Also, you mentioned getting rid of the 2-D array indicator.  I'm assuming that you're emphasizing the 2-D part; did you mean that or did you mean get rid of the indicator, period?  The indicator is there so I can wire the connector terminal correctly on the front panel.  Is there another way to do that?



0 Kudos
Message 3 of 4

To really know what is in each cluster, delete the broken wire.  Right click and do a Create Constant on the function or terminal that is sourcing the wire, and again on the function or terminal that is receiving the wire.  Turn on context Help  (Ctrl-H) and hover over each constant  it will give you a detailed breakdown of how the cluster is made up.


The 2-D array is the wrong datatype.   If you want to see it on the front panel, or connect it to the connector panel, you need to delete it, right click on the wire and pick Create Indicator so you can get an indicator that is the correct type.


As for the combo box, the value, while you often think of as being numeric, can actually be a string.  So it doesn't have to be a number, the value can be anything.  By default for a new combo box, the strings and the values are the same.

0 Kudos
Message 4 of 4