QM  4.0.0
Working with Initial Transitions

Every state machine needs the top-most initial transition, which originates in an initial pseudostate (black dot) placed directly on the drawing canvas and points to the first active state after the state machine gets initialized.

Additionally, a composite state with nested substates might also have its own nested initial transition, which also originates in an initial pseudostate but placed inside a superstate and points to the default substate that becomes active after the superstate is entered by a transition.

Top-Most and Nested Initial Transitions

In most UML tools, the process of drawing such initial transitions consists of first adding an initial pseudostate (black dot) and then attaching a transition between it and some state. In QM™ this process is simplified, because the State Machine Toolbox contains ready-to-use Initial Transition tool, which combines an "initial pseudostate" with a transition attached permanently to it. This tool is used to add both the top-most initial transition and initial transitions nested within superstates.

Adding Initial Transition

You select the Initial Transition tool by clicking on the button the State Machine Toolbox. At this point, when you hover the mouse over the active state diagram, the mouse pointer changes to the initial transition tool. To add an initial transition, move the mouse to the desired location of the initial pseduostate of the initial transition and press and hold down the left mouse button. At this point the mouse pointer changes to the initial tran with the "forbidden" icon (). Next, you need to drag the mouse to an edge of the target state. (If you release the mouse button without reaching the target state edge, the QM™ tool will delete the transition.) When you drag the mouse pointer over a state edge, the mouse pointer changes to the initial transition with an anchor (), which indicates that you can anchor the end of the initial transition connector at this edge. To anchor the transition, release the mouse button.

Adding Initial Transitions

Invalid Initial Transitions

As you keep working on your state diagram, some initial transition(s) might easily become invalid. For example, after resizing of a state the initial pseudostate (black dot) of an initial transition might fall outside of the state shape, might start targeting a non-substate of the parent state, or a state might "acquire" an additional (second) initial transition. Such invalid initial transitions are shown with dashed line.

The following animation shows how an initial transition can become invalid and how QM™ renders it:

Invalid Initial Transition

Initial Transition Property Sheet

Initial Transition item can be configured by the Initial Transition-Specific Property Sheet.

Initial Transition Property Sheet

The Initial Transition property sheet contains the following properties:

Initial Transition Action

An Initial Transition can have optional action. If defined, the action shows up in the text-box associated with the Initial Transition.

An action is considered defined if the corresponding pseudocode or code boxes in the Initial Transition Property Sheet are not empty. Once an action is defined, it is shown in the text box associated with the Initial Transition (following the forward-slash / character).

The pseudocode property is designed to avoid clutter in the diagram by minimizing the amount of text to display beside the transition. Pseudocode is intended only for displaying in the diagram and has no implications for code generation. Only the Code entry of the action property matters for code generation.
See also
How QM displays action code in the text box
Moving and Resizing the Transition Text-Box

Once the initial transition is selected as the Current Item, you can move and resize the text-box by dragging it around or dragging the lower-right handle of the box (see the screen animation above).

Routing Transition Path

All transitions in QM™ are rectilinear, meaning that they consist only of horizontal or vertical segments. You can adjust the position of the horizontal segments by dragging them up or down or the vertical segments by dragging them left and right.

Next: Working with Transitions to History