I’m trying to change the style of widgets. But there is no same size, units,… for every variable (I exclude compound widgets and snippets). I think, that using string in PLC for style is annoying. I want something like use enum in program and link it to style in widget over expression. Is the some way how to do it?
Hey Jan,
Did you tried to use List binding?
GUID: 7578fe75-77b8-467c-b277-565658467f17
Or widgets have action called setStyle
Hope it helps
Ondrej
@Ondrej_Petr Thanks for reply, the list was functional. But there is some way to bind some constant value or tmx texts?
I try session variable, but it’s need to define in every visualization.
The OPC list is OK, but it’s defined in PLC.
Hello Jan,
I dont think I understand your problem well.
If you want to use Constant or .tmx then you dont need binding if the style is not changing during runtime.
If you want it to change, you need to use the binding or setStyle Action.
With Binding, you can use session variable but it will be valid just for one client and not changing for other clients. You can use OPC Ua connection to your code, then you might loose multiclient functionality if handled with one variable.
In the code you can do whatever you want. Read .tmx file, use constants…
I hope I answered your question
Hello @Ondrej_Petr,
i have lot of vars, where I want to change style in depend of limits (ok, warning, critical,..). I can set the style in PLC over enum. Actually, I have binding list with OPC UA (I also try session vars) and it’s functionally. But this list binding is depend on variables, so I want to know, if there is some way, how to do list binding with predefined constants (in list definition) without variables. I just want to know if there isn’t an easier and robusted path to the same result.
Action styleSet is OK, but I think, thats complicated for lot of variables (approximately 30% of the variables will change style).
I also need to use this in compound widgets.
Hi @NovotnyJ
There is maybe something but I’m not sure it’s more simple to implement on a big number of widget.
You add a listbox widget invisible, you enter the dataprovider yourself.
[{"value":"style0", "text":""},{"value":"style1", "text":""}]
Now bind the selectedValue of the listbox to the style property of your widget and create a binding on the selectedIndex of the listbox to an integer value in the PLC.
I don’t really know it could be something, maybe take care about the number of widgets it could add.
I think a simple way to implement is using a compound widget.
Hope it help !
Regards,
Florent