Adding HMI Logic x
Using Behaviors Behaviors
To apply logic to the nodes in a no-coding-approach, CGI Studio provides behaviors. Behaviors are small generic functions that can manipulate the nodes in the Scene Tree. By setting configurable properties, behaviors can be adapted to apply to multiple different scenarios without the need to create new ones. Another feature of behaviors is that they communicate via events. Events allow sending data from one behavior to another behavior without knowing any details about each other.
In this section, the value of the gauge (needles) will be forwarded to the text value in the center of the gauge, using behaviors.
1. Click Scene > Car_Cluster in Solution Explorer.
- Car_Cluster is displayed in Scene Tree.
- ExtraSceneTree is displayed at the right-side view of Scene Tree.
2. Click and select the control RPMGauge.
- The behaviors of RPMGauge are shown in ExtraSceneTree.

3. Select Forward Value behavior from the Toolbox.
- On the top part of the Toolbox, there is a search bar to easily find nodes or behaviors that are needed.

4. Move Forward Value behavior to ExtraSceneTree of RPMValue by drag-and-drop operation.

5. Click the added Forward Value behavior to show its Properties.
6. Click the browse button on the right-side of TargetNode TargetNode
7. For the TargetNode value, select RPMGauge_Group > RPMValue.
- Through this operation, the value of RPMGauge control is automatically forwarded to the RPMValue control.

8. Repeat steps 2 to 7 from above for SpeedGauge control.
- For SpeedGauge control, select SpeedGauge_Group > SpeedValue as TargetNode in Step 7.
Adding Multilanguage Features
You can easily switch languages by using CGI Studio multilanguage support function. In this section, you will understand how to apply the multilanguage support function to switch between English and Germany (miles and kilometer). At first, you need to set-up a culture for this.
1. Click the globe icon from the menu bar.
- The "Solution Options : Cultures" dialog is displayed.
- This dialog is also accessible through the menu bar by selecting File > Solution Options… > Cultures.

2. Click the globe with a plus icon to add new culture setting row.
3. Select English [en] from the Culture drop-downlist.
4. Repeat step 2 above but select German[de] this time.

6. Click Scene > Car_Cluster in Solution Explorer.
- Car_Cluster is shown in the scene tree.
- ExtraSceneTree is shown in the right-side on the Scene tree.
7. Click the triangular icon beside StatusBottom.
- StatusBottom is expanded and items Temp, Petrol and Odometer are shown.
8. Click Odometer.
9. In the Properties, under Control category, click the browse button next to the input field of the Format Text property.

10. The Language Table Selection is opened.
- The Language Table dialog may also be opened via the menu bar Language > Language Table…
- The drop-down on the top right allows selection of the Current Culture.
11. Click the Add button while Master[00] is set as Current Culture.

12. Set the value as seen below to the newly added row.
| Target item | Setting value |
| Text | Trip: %04d km |
| Translation Hint | mileage |
13. Change the Current Culture by selecting either English[en] and/or German[de] from the drop-down list, then set the value as seen below for each culture.
| Culture | Setting value |
| English[en] | Trip: %04d miles |
| German[de] | Trip: %04d km |
14. After the previous set-up, click the OK button to close the dialog box.
15. In the Culture Solution Option in the tool bar, switch between English and German. The distance unit should change to "miles" or "km" accordingly.
- When English[en] is selected, the unit is “miles”.
- When either Master[00] or German[de] is selected, the unit is “km”.

Simulation via CGI Player and Value Generator
In this section, simulation will be run via CGI Player based on the settings made in Using Behaviors and Adding Multilanguage Features.
1. Run the CGI Player and perform simulation on RPMGauge and SpeedGauge.
- Refer to Run CGI Player and Run simulation by Value Generator how to operate.
- Based on the settings of Using Behaviors, the value in the center of the Gauge must be changed according to the Gauge needle value.
2. Click the Value Generator tab.
3. Change the value on Maximum as below for RPMValue and SpeedValue.
| Items | Setting value |
| RPMValue | 8000 |
| SpeedValue | 240 |

4. Next, select from the Culture selection drop-down and switch English/German.

- When en (English) is selected, “miles” should be shown accordingly.
