|LabVIEW 2015 Help|
|LabVIEW 2016 Help|
|LabVIEW 2017 Help|
|LabVIEW 2018 Help|
|LabVIEW 2019 Help|
Use the ring and enumerated type controls and indicators located on the Ring & Enum and Classic Ring & Enum palettes to create a list of strings you can cycle through.
Ring controls are numeric objects that associate numeric values with strings or pictures. Ring controls appear as pull-down menus that users can cycle through to make selections.
Ring controls are useful for selecting mutually exclusive items, such as trigger modes. For example, use a ring control for users to select from continuous, single, and external triggering.
Right-click a ring control and select Edit Items from the shortcut menu to add items to the ring control list in the control. The order of the items in the Edit Items page of the Ring Properties dialog box determines the order of the items in the control. You also can configure the ring control so users can enter numeric values not already associated with any entries in the list of items defined for the control.
To enter an undefined value in the ring control at run time, click the control, select <Other> from the shortcut menu, enter a numeric value in the digital display that appears, and press the <Enter> key. The undefined value appears in the ring control in angle brackets. LabVIEW does not add the undefined value to the ring control list.
When you configure the list of items for a ring control, you can assign a specific numeric value to each item. If you do not assign specific numeric values to the items, LabVIEW assigns sequential values that correspond to the order of the items in the list, starting with a value of 0 for the first item.
Use enumerated type controls to give users a list of items from which to select. An enumerated type control, or enum, is similar to a text or menu ring control in that both contain lists of strings through which you can cycle. However, enumerated type controls differ from ring controls in the following ways:
All arithmetic functions except Increment and Decrement treat the enumerated type control the same as an unsigned integer. Increment changes the last enumerated value to the first value, and Decrement changes the first enumerated value to the last value. When coercing a signed integer to an enumerated type, negative numbers change to equal the first enumerated value, and out-of-range positive numbers change to equal the last enumerated value. Out-of-range unsigned integers always change to equal the last enumerated value.
If you wire a floating-point value to an enumerated type indicator, LabVIEW coerces the floating-point value to the closest numeric value in the enumerated type indicator. LabVIEW handles out-of-range numbers as previously described. If you wire an enumerated control to any numeric value, LabVIEW coerces the enumerated type value to a numeric value. To wire an enumerated type control to an enumerated type indicator, the items in the indicator must match the items in the control. However, the indicator can have more items than the control.
|Tip When using enumerated type controls, always make a type definition of the control. Creating type definitions prevents you from needing to rewrite the code each time you add or remove an item from an enumerated type control.|