LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to programmatically update array control combo box type def?

Solved!
Go to solution

I am using LV 8.6.1 and I am trying to create an array control front panel object in which the user can select a combo box item for each element in the array.  I also need to periodically update the combo box list of values.  I currently have configured the combo box (Automation Sequence Selection - see attached) as a non-strict type def so that I can write new strings to the list of values when I need to.  But I can't seem to figure out how to have the array (Batch List - see attahced) populate with the new-valued combo box.

 

The Automation Sequence Selection box refelcts the new string that I programmatically add, but the combo boxes in the Batch List array control do not have the new string.

 

Anyone have ideas?

 

I have attached screen shot of the combo and array controls.

Thanks


Dan

 

0 Kudos
Message 1 of 12
(13,274 Views)

With the Strings And Values property node.

 

Message Edited by Ravens Fan on 02-22-2010 03:03 PM
0 Kudos
Message 2 of 12
(13,256 Views)

O.k, so what you posted wil update the combo box (I already have this), but this still does not seem to update an array control that is associated with the combo.  If you read my post and had a look at the attachment I posted, I want the Batch List array control to be populated with the combo box, which also has the new string and value.

 

 

0 Kudos
Message 3 of 12
(13,246 Views)

Your screenshot just shows a front panel.  I thought you wanted to update combo boxes programmatically during the execution of your program.

 

You say that you have an array control associated with a combobox?  How did you do that?  A combobox is a specialized version of a string.  Your array is an array of strings, or an array of comboboxes.

 

You're saying you want the typedef of the combobox to be affected by the data you have in a separate string array?

 

One important thing to know about typedefs' is that they affect numerous properties of a control.  Going one step further, a strict typedef locks in those properties so a programmer can't modify them.  The value of a control cannot be established by a typedef.  Thus you can't lock values into an array by using a typedef.  Also, you can only modify a typedef during edit time.  You can't make changes to a typedef while that control is in execution and expect it to have an affect on your running VI.

 

If you want some more help.  Please post an actual VI instead of a screenshot so we can see what it going on behind the scenes.

Message Edited by Ravens Fan on 02-22-2010 05:08 PM
0 Kudos
Message 4 of 12
(13,235 Views)

I want an array of type def combo boxes (or ring or enum controls) that will update with the newly added values when I programmatically change the strings and values of the type def combo box.

 

In my screenshot , the type def is the combo box (automation sequence selection).  I write to the strings and values prop when I want to add a new value and this works just fine.  The combo box (Automation sequence selection) reflects this change.

 

I also want an array of the type def combos (Batch List).  The user can fill in the array control such that each element is selected from the list of items in the combo box.  But when I make the programmatic change to the strings and values of the combo, these changes are not refelcted in the combos that are elements of the array (Batch List).

 

I believe this is bc the strings/value of combos are not part of the typ def.  While with an enum the values are part of the type def, you can't write to the strings prop of an enum programmatically while a VI is running.  I need to programmatically update a list of items in the combo (or whatever: enum, ring) while the VI is running and have the values update in all instances of the combo.

 

Dan

0 Kudos
Message 5 of 12
(13,224 Views)
Solution
Accepted by topic author DBerry

I was considering mentioning that strings and values were a property that could not be stored in a typedef, but when I tried it out, it seemed like it was.  So I just didn't comment on that.  Maybe the strings and values can be part of the typedef, maybe not.  Values of controls certainly can not.  Strings and Values may be in kind of a gray area.  But you certainly can't expect changes to one control to automatically update another control because they are typedefs.  You can't modify typedefs at runtime.

 

Let's put it as another example that has nothing to do with values.  You have a regular typedef of a numeric.  It is saved with red text in scientific notation.  You drop two instances of that on your block diagram.  You can programmatically change each one to other colors or other numeric display formats.  Changing one does not affect the other.  If it was a strict typedef, you'd be locked into the way it was saved and could not change it programmatically.

 

 

Take a look at this.  If you are able to programmatically update your strings and values list for a single combobox (a scalar string) you will be able to update it for when the combobox is the datatype for an array.  You just need to get to a reference of the element of the array.  This does not use typedefs in anyway.

 

 

Message Edited by Ravens Fan on 02-22-2010 05:28 PM
Message 6 of 12
(13,217 Views)

Thank you for the assistance.  This works just as I need.  I thought I needed to have the combo typ defined in order for the array to reflect the change in combo items.  I didn't realize it was possible to access the array element reference property, but I now understand.

 

Thanks again.

 

Dan

0 Kudos
Message 7 of 12
(13,205 Views)

how did you concatenate the two values? is it append arrays?

 

thanks!

0 Kudos
Message 8 of 12
(9,534 Views)

@developer001 wrote:

how did you concatenate the two values? is it append arrays?


The Build Array function has the ability to concatenate inputs.  If the inputs being combined have the same number of dimensions you can right click and choose to concatenate.  If one input is one less dimensions than the other, then the concatenate is set already.

 

http://zone.ni.com/reference/en-XX/help/371361J-01/glang/build_array/

0 Kudos
Message 9 of 12
(9,505 Views)

If a linked property node works for you it's much simpler than the class method shown above

Robzilla_0-1660345840791.png

 

0 Kudos
Message 10 of 12
(1,988 Views)