Item Lists of Combo Box/Ring Constants Do Not Update from Type Definitions

Updated Nov 14, 2023

Reported In

Software

  • LabVIEW Base

Issue Details

I have a type definition that includes a combo box/ring control and I have created a constant from that type definition on the block diagram of a VI. If I then go back to the type definition and edit the item list of the combo box/ring control, LabVIEW does not automatically update the constant to which it is linked. Whether I make the type definition strict or not does not appear to make a difference. Furthermore, right-clicking the constant and selecting Update from Type Def. does not appear to propagate the changes either. Why is this happening and how can I get my item lists of my constants to update automatically from their type definitions?

Solution

The described behavior is actually expected. The basic type definition functionality of combo boxes and rings can best be described by quoting the type definition description that can be found in the LabVIEW Help documentation: 

"Because type definitions identify only the data type, only the values that are part of the data type update.... Because the item names in ring [combo box] controls do not define the data type, changes to ring [combo box] control item names in a type definition do not change the item names in instances of the type definition."

The best way to illustrate this concept is to open the context help window in LabVIEW, done by selecting Help»Show Context Help, and to look at the data type of a wire coming out of a combo box/ring control on the block diagram. The data type is just a regular string (as opposed to some special combo box data type), so the actual items in a type-defined combo box do not update when they are changed since they have nothing to do with the actual data type. However, changing the representation of the ring control will automatically update the control to reflect the change in representation.

 

Additional Information

To help explain things, the first caveat to be aware of is that block diagram constants cannot be strict type definitions. When a constant is tied to a strict type definition, it is simply down-casted to a regular type definition, so the question is really reduced to why items in a combo box/ring are not updated as a regular type definition. 

In contrast, enums, which are similar in function to combo boxes and rings, do have their own (enum) data type on the block diagram. Again, you can verify this by looking at the data type of its associated wire on the block diagram. For this reason, enum items do update with their type definitions. 

In order to have constants update along with their type definitions, enums will need to be used instead of combo boxes/rings. They have their own data type, which makes them much more versatile in how you can read their values on the block diagram. To access the selected item's label on the block diagram (like a combo box would return), simply wire the enum terminal to the input of the Format Into String function, and the item name will be automatically returned.