Ring and Enumerated Type Controls and Indicators

LabVIEW 2018 Help


Edition Date: March 2018
Part Number: 371361R-01
View Product Info

DOWNLOAD (Windows Only)


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

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.

Enumerated Type Controls

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:

  • The data type of an enumerated type control includes information about the numeric values in the control and their corresponding strings. The data type of a ring control is numeric only.
  • The numeric representation of the enumerated type control is an 8-, 16-, or 32-bit unsigned integer, while ring controls can have additional representations. Right-click either type of control and select Representation from the shortcut menu to change the representation of the control.
  • You cannot allow the user to enter undefined values in enumerated type controls, and you cannot assign specific numeric values to items in enumerated type controls. If you need this functionality, use a ring control.
  • You can edit the items of an enumerated type control only at edit time, while you can edit ring control items at run time using a Property Node.
  • When you wire an enumerated type control to the selector terminal of a Case structure, LabVIEW matches the cases to the string values of items in the control, not the numeric values. When you use a ring control with a Case structure, LabVIEW matches cases to the numeric values of items.
  • When you wire an enumerated type control to the selector terminal of a Case structure, you can right-click the structure and select Add Case for Every Value to create a case for the string value of each item in the control. However, when you wire a ring control to the selector terminal of a Case structure, you must manually enter each case.

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.

WAS THIS ARTICLE HELPFUL?

Not Helpful