-
Notifications
You must be signed in to change notification settings - Fork 4
(Use case) Change style on variable change
Stephan Stricker edited this page Sep 1, 2022
·
8 revisions
- Automation Studio 4.4
- mappView 5.4
- Add a new theme to the project
- Add a new style set package
- Add a new style file, add the style definition below and add the file to the styleset
- Add the event binding in the event binding file
Only styleable properties can be changed. See the widget documentation for details. Only properties that have not been changed from the default can be changed. For example, if the backColor of a widget has been changed in the editor to a different value, then the backColor can no longer be changed by an event action.
Add a new theme to the project and add the theme to the .vis file in the configuration view
<StartTheme themeRefId="BuRTheme1" />
<Themes>
<Theme refId="BuRTheme1"/>
</Themes>
Add a new style set package and copy the following code into the style set file.
<?xml version="1.0" encoding="utf-8"?>
<StylesSet id="stylesset_1" xmlns="http://www.br-automation.com/iat2015/stylesset/engineering/v1">
<Styles refId="CMStyles" />
</StylesSet>
Add a new styles file to the style set and copy the following code into it.
<?xml version="1.0" encoding="utf-8"?>
<Styles id="CMStyles" xmlns="http://www.br-automation.com/iat2015/styles/engineering/v1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<Style id="Output_OK" xsi:type="widgets.brease.NumericOutput" backColor="#2FC43B" fontSize="16px"/>
<Style id="Output_ERR" xsi:type="widgets.brease.NumericOutput" backColor="#A81717" fontSize="16px"/>
</Styles>
Adjust the following items:
- OPC Variable -> ::ConditionM:CM_data_analyse.RmsStatus
- Content page -> ConditionAnalyse_content
- Style -> Output_OK, Output_ERR
<EventBinding>
<Source xsi:type="opcUa.Event" refId="::ConditionM:CM_data_analyse.RmsStatus" event="ValueChanged"/>
<EventHandler condition="newValue=0">
<Action>
<Target xsi:type="widgets.brease.NumericOutput.Action" contentRefId="ConditionAnalyse_content" widgetRefId="labRmsStatus" >
<Method xsi:type="widgets.brease.NumericOutput.Action.SetStyle" value="Output_OK" />
</Target>
</Action>
</EventHandler>
<EventHandler condition="newValue >0">
<Action>
<Target xsi:type="widgets.brease.NumericOutput.Action" contentRefId="ConditionAnalyse_content" widgetRefId="labRmsStatus" >
<Method xsi:type="widgets.brease.NumericOutput.Action.SetStyle" value="Output_ERR" />
</Target>
</Action>
</EventHandler>
</EventBinding>
General Information
Direct binding
Event binding
Use cases
- General
- Widgets
- Styles
- Text
- Content