Editing the enums in the enum-editor

How to edit an enum-object in the enum-editor:

  1. Select the needed elementary →data type from the list next to Type.
    This data type is the →base type for the declaration of the enum.

  2. Optional: Enter an →initial value for the entire declaration , e .g. a →named element or a literal matching the data type .

  3. Optional: Enter a comment, description and custom data in the respective fields.
    If you need a new line in these fields, press the Enter-key. If you need the code for a newline in a textual editor, please refer to "Which code is required for a newline in a description or comment?".

  4. How to change a named element that is already listed under Elements:

    1. Change the name of a given element by first pointing to the element name and then double-clicking.
      Alternative: Select the element and press the F2-key or select the command Rename in the context menu.
      Result: A text field opens. Enter the new text and press the Enter-key. To discard the new text, press the ESC-key.

    2. Assign a value to the element by first pointing to the value of the element and then double-clicking.
      Alternative: Select the element and press Ctrl+I or select the command Edit Initial Value in the context menu.
      Result: A text field opens. Enter the new value and press the Enter-key. To discard the new value, press the ESC-key.

  5. How to create a new named element: Select an element and press Ctrl+Shift and the +-key.
    Alternative: Select the command Add New Element in the context menu.
    Result: A new element is inserted at the end of the list based on the selected element. Modify this new element according to your needs, as described in step 3.

  6. How to delete already named elements: Select one or more elements and press the Del-key.
    Alternative: Select the command Delete in the context menu.
    images/s/b2ic8e/9012/1ca6q62/_/images/icons/emoticons/information.svg You select multiple elements by holding down the Ctrl-key or Shift-key while clicking on multiple elements.

  7. Close the enum-editor and accept all changes by clicking OK.
    images/s/b2ic8e/9012/1ca6q62/_/images/icons/emoticons/information.svg If you want to close the enum-editor and discard the changes, click Cancel.

Good to know

images/s/b2ic8e/9012/1ca6q62/_/images/icons/emoticons/lightbulb.svg How to undo the most recent edit action in the enum-editor: Press Ctrl+Z (once for the last action ; several times for multiple actions ).

images/s/b2ic8e/9012/1ca6q62/_/images/icons/emoticons/lightbulb.svg How to redo the most recent undone edit action in the enum-editor: Press Ctrl+Y (once for the last action; several times for multiple actions).

images/s/b2ic8e/9012/1ca6q62/_/images/icons/emoticons/lightbulb.svg When entering an invalid initial value for the entire declaration or name/value for the named element, you can recognize errors due to the icon images/download/attachments/405733678/IconError-version-1-modificationdate-1529909643654-api-v2.png in front of the entire initial value, name or value. If you move the mouse cursor over the icon, you will get more detailed information about the error.
If you press the Enter key when an error is displayed, the invalid entire initial value, name or value will not be applied.

images/s/b2ic8e/9012/1ca6q62/_/images/icons/emoticons/lightbulb.svg In case of warnings or errors that relate to the entire enum, the corresponding message is displayed below the list with the named elements.

images/s/b2ic8e/9012/1ca6q62/_/images/icons/emoticons/lightbulb.svg The initial value for the entire declaration and the values for the named elements might be a →constant expression.
Moreover, observe the following for the values of named elements:

  • If you need a new line in a constant expression (= in Value), press the Shift+Enter.
    Result: After pressing the Enter-key to apply the changes for the element, all lines under Elements will be displayed with multiple lines. To display the lines again with fewer lines or as a single line again, you have to delete the previously specified new lines under Value, close the editor with OK and open it again.

  • If you need a new line in a STRING value, you must specify the character combination $N. Example: 'Here the 1st line.$NAnd here the 2nd line.'
    For special characters in a STRING/CHAR value, such as umlauts, you must enter the appropriate three-character combination of the dollar sign ( $ ) followed by two hexadecimal digits. See the glossary item "→Character string literal" for some examples.

Restrictions

  • You cannot change the order of named elements that are already listed under Elements in the enum-editor. If necessary, change the order in the →textual editor.

  • With respect to namespaces:

    • For an existing enum-object, it is only possible to specify a namespace in the textual editor. The required syntax is analogous to the ST-syntax (see "Namespaces in ST: declaration").

    • Likewise, it is only possible to change or delete a namespace (entered when the enum-object has been created) in the textual editor.

    • If you want to use a constant expression outside the current namespace as an initial value for the entire declaration or as a value for a named element, you must specify the fully qualified name of the named element .
      A fully qualified name consists of a sequence of namespace identifiers separated by . (dots). Example: The fully qualified name is NS1.TrafficLight#Green, if the named element TrafficLight#Green has been declared in the namespace NS1.