Difference between revisions of "Exit State Icon Properties"

From Flowcode Help
Jump to navigationJump to search
 
Line 1: Line 1:
An Exit State is a special type of state icon that is used to leave the macro and return to the macro that called this macro.
+
[[File:iconExitState.png|border]]
  
 +
An Exit State icon is used within a [[State_diagrams|State Diagram macro]] to represent a special [[State_Icon_Properties|State icon]] that exits this macro and returns program control to the macro that originally called this macro.
  
During simulation or when using ICD, the state will be drawn with a thick orange outline when it is executing and when its exit transitions are being evaluated.
+
A State Diagram can include zero, one or several Exit State icons.
  
First, the state function, if it exists, will be executed. 
 
  
Next, the transitions will be evaluated and the first one with a true condition is drawn in orange with other transitions (even if they are true) drawn in blue.
+
==Details==
 +
{| style="margin:0px; text-align:center;"
 +
|-
 +
|[[File:iconExitState.png|border]]
 +
|width="50px" |→
 +
|[[File:Properties_ExitState.png]]
 +
|}
  
The program will then execute this first true transition.
+
Like a normal State icon, an Exit State icon has a display name (i.e. the text displayed on the state within the diagram) and an optional function.
 +
In addition, an Exit State may pass back a specific return value (if this State Diagram specifies a return type).
  
If all transitions leaving the state are false, then they will all be shown as blue and the state with be executed again.
+
 
 +
'''Display Name'''
 +
 
 +
The name of the icon that appears in the Exit State icon in the State Diagram.
 +
 
 +
This can be optionally displayed or hidden on the icon itself when the "Show" tick-box is unticked.
 +
 
 +
 
 +
'''Function'''
 +
 
 +
The function is code that is executed when the program flow enters this Exit State icon.
 +
 
 +
This can be to call a macro, perform a calculation, delay program execution or execute some custom code.
 +
 
 +
 
 +
States will perform their optional function when program flow enters that state through a transition from another state.
 +
 
 +
 
 +
The function can be optionally displayed or hidden on the icon itself when the "Show" tick-box is unticked.
 +
 
 +
 
 +
'''Edit...'''
 +
 
 +
Click the "Edit..." button to change the details of the selected function. This button will be hidden if the function is set to "Do nothing" and will be labelled "Choose macro..." if the "Call Macro" function is chosen.
 +
 
 +
This will open another property window that is specific to the selected function. More details are here:
 +
 
 +
{| class="wikitable"
 +
|+
 +
|-
 +
| [[Macro_Icon_Properties|Call macro]]
 +
|-
 +
| [[Calculation_Icon_Properties|Calculation]]
 +
|-
 +
| [[Delay_Icon_Properties|Delay]]
 +
|-
 +
| [[Code_Icon_Properties|Code]]
 +
|}
 +
 
 +
 
 +
'''Set return value'''
 +
 
 +
State Diagrams that specify a return type will enable this tick-box, which allows the Exit State to set the return value when it is executed and passed program control to the calling macro.
 +
 
 +
When ticked, this box will allow a value or variable to be specified in the "Return Value" box.
 +
 
 +
If left unticked, the return value will be the value of the local "Return" variable (assuming this macro specifies a return) in the same way that a normal macro can set its return value.
 +
 
 +
 
 +
'''Return Value'''
 +
 
 +
The return value passed to the calling macro can be set here.
 +
This can be a literal value, an expression, or a variable of a compatible type to this macro's return type.
 +
 
 +
Clicking the down arrow to the right of the box will allow a global or local variable to be chosen from those available.
 +
 
 +
 
 +
==Example of a State Diagram==
 +
 
 +
[[File:State0.png|State Diagram Overview]]

Latest revision as of 14:41, 12 June 2026

IconExitState.png

An Exit State icon is used within a State Diagram macro to represent a special State icon that exits this macro and returns program control to the macro that originally called this macro.

A State Diagram can include zero, one or several Exit State icons.


Details

IconExitState.png Properties ExitState.png

Like a normal State icon, an Exit State icon has a display name (i.e. the text displayed on the state within the diagram) and an optional function. In addition, an Exit State may pass back a specific return value (if this State Diagram specifies a return type).


Display Name

The name of the icon that appears in the Exit State icon in the State Diagram.

This can be optionally displayed or hidden on the icon itself when the "Show" tick-box is unticked.


Function

The function is code that is executed when the program flow enters this Exit State icon.

This can be to call a macro, perform a calculation, delay program execution or execute some custom code.


States will perform their optional function when program flow enters that state through a transition from another state.


The function can be optionally displayed or hidden on the icon itself when the "Show" tick-box is unticked.


Edit...

Click the "Edit..." button to change the details of the selected function. This button will be hidden if the function is set to "Do nothing" and will be labelled "Choose macro..." if the "Call Macro" function is chosen.

This will open another property window that is specific to the selected function. More details are here:

Call macro
Calculation
Delay
Code


Set return value

State Diagrams that specify a return type will enable this tick-box, which allows the Exit State to set the return value when it is executed and passed program control to the calling macro.

When ticked, this box will allow a value or variable to be specified in the "Return Value" box.

If left unticked, the return value will be the value of the local "Return" variable (assuming this macro specifies a return) in the same way that a normal macro can set its return value.


Return Value

The return value passed to the calling macro can be set here. This can be a literal value, an expression, or a variable of a compatible type to this macro's return type.

Clicking the down arrow to the right of the box will allow a global or local variable to be chosen from those available.


Example of a State Diagram

State Diagram Overview