Default transitions differ from normal transitions in not having a source object. You can create a default transition with these steps:
Create a transition.
Attach the destination end of the transition to an object.
Position the source endpoint for the transition.
If you assume that the variable sA
is a handle to state A, these
commands create a default transition and position the source 25 pixels above and 15
pixels to the left of the top midpoint of state A:
dt = Stateflow.Transition(sA); dt.Destination = sA; dt.DestinationOClock = 0; xsource = sA.Position(1)+sA.Position(3)/2; ysource = sA.Position(2)-30; dt.SourceEndPoint = [xsource ysource]; dt.MidPoint = [xsource ysource+15];
The created default transition looks like this:
This method is also used for adding the default transitions toward the end of the example chart constructed in Create Charts by Using the Stateflow API.