State Categories can be thought of as folders for states. State Categories are used for a number of reasons:
- To organize similar states into categories
- To allow multiple states to be set at the same time (if not sharing variables between states)
- To create multiple enumerations for more expressive code (if not sharing variables between states)
- To enable including and excluding particular variables from assignment
State categories will appear as folders in Glue which can contain any number of States.
Note that categorized cannot be added inside of other categories.
Adding a State Category
To add a state category:
- Expand a Screen or Entity that you want to add a category to
- Right-click on the States item
- Select “Add State Category”
- Enter the name for the new category
- Click OK
State Categories as StateData
StateData is the concept of treating states similar to CSV data. Glue supports treating States as CSV data by providing a CSV-like interface when selecting a category, as shown in the following image:
For an in-depth discussion of State Data, including how to exclude variables from inclusion, see the State Data blog post.
The SharesVariablesWithOtherCategories controls whether the State Category shares variables with other categories. This value is false by default. If you set the value to, then the only purpose of the category is organizational in Glue – all states contained in the category will behave the same as if they were not contained in any category.
If this value is set to false, then the category will be treated separate from other categories and from uncategorized states. This means that the category:
- Will create a separate enum value
- Will create a separate property of this enum type in the given Screen/Entity
- Will create InterpolateToState and InterpolateBetween functions for this enum type
- Will allow exposing and tunneling of a new variable type in Glue
- Will allow setting the new category state in GlueView