How it works...

When we created the menu items, the system defaulted many properties for us. If the table only has one state machine, all we had to do was set the label properties. You may notice that this changed the menu item's properties so that it referenced the state machine class that was generated by the table's state machine.

When we test the buttons, we can see that if we choose a transition that is not valid, we get this error:

We can't change this message as it is controlled by a protected method, and we shouldn't edit the generated classes. With generated code, any changes are lost if the state machine is regenerated.