Step 4 - Telltales, temperature, time¶
In this step, you create the controls for the telltales, and the temperature and time shown in the cluster header.
Control telltales¶
In this section, you use the structure and properties for telltales that Kanzi Figma Importer imported from the Figma design. The main task here is to add the bindings so that you can control the telltales from the Control node.
The TTs_1507:14058 prefab contains the telltales.
To control the telltales:
In the Node Tree, in Cluster Components > TTs, set the Prefab Template property to the TTs_1507:14058 prefab.
In the Prefabs, in the TTs_1507:14058 prefab, for every telltale, change the Prefab Template property from the Resource ID to the prefab template of that node.
For example, for the a02-low-beam-dipped-beam Prefab View, set the Prefab Template property to a02-low-beam-dipped-beam_1768:918.
This way, when you clean up your project by removing unused items, Kanzi Studio keeps the telltales.
In the Library > Property Types > Figma Importer > Component > Telltales, drag all properties except the leftGaugeSwap and rightGaugeSwap to the Control node.
To control the telltale visibility from the Control node, in the Prefabs, in the TTs_1507:14058 prefab, for each telltale, edit the binding to the Visible property to change the alias in the binding expression from #1507:14058 to #Control.
For example, for the a02-low-beam-dipped-beam Prefab View, change the binding expression from
{#1507:14058/FigmaImporter.Component.18_Low_Beam_1727:0}
to
{#Control/FigmaImporter.Component.18_Low_Beam_1727:0}
You can now control the telltales from the Control node.
Set temperature and time¶
The top panel of the cluster contains the temperature and time.
To set the temperature and time:
In the Node Tree, in the Cluster Components > PanelTop > Outside Temperature > Outside Temperature_1 Text Block node, bind the Text property to the OutsideTemp property in the Control node.
temperature = round({#Control/Control.OutsideTemp} * 2) / 2 format("{:.1}°C", temperature)
This binding:
Multiplies the outside temperature value by 2, rounds the result to get an integer value, and divides the result by 2. This way only half-degree changes are shown.
Formats the string to show the value with one decimal precision and the
°C
unit.
In the Cluster Components > PanelTop > Icon_Snow Prefab View, bind the Node > Visible property to this binding expression
STEP({#Control/Control.OutsideTemp},1.5)
This way you show the snowflake icon when the outside temperature is below 1.5°C.
In the Icon_Snow Prefab View, change the Prefab Template property from the Resource ID to the Icon_Snow_2079:1062.
In the Node Tree, in the Cluster Components > PanelTop > Time > Time_1 Text Block node, bind the Text property to the time properties in the Control node:
minutes = {#Control/Control.TimeMinutes} hours = {#Control/Control.TimeHours} format("{0:02}:{1:02}", hours , minutes)
To learn more about how to format strings with bindings, see the format binding function documentation.
You can now set the temperature and time in the Control node.