Compound widget Widget event

I have a compound widget with a toggle button in it. I made a bindable property to this toggle Button’s “value”.

In the content there is an OPC UA variable binded to this “btnValue” property of the compound widget.

My problem is the Eventbinding I made. Another switch inside the compount widget should change its value to true if the toggle button changes to true.

This works perfect as long as I click on the toggle button → the switch changes his state and the OPC Ua Variable too…

But if I change the value of the OPC UA variable in the watch window, the toggle button still changes it state (because it is mapped to it inside the compound widget) but the eventbinding is not executed even the toggle button has changed it value? Why? My switch keeps the same if I change the value in the watch window but changed if i click on the toggle button directly…

Hi Stefan,

I believe this is a common behavior. The value changed event is only fired if the value changes through the HMI, but not when connected OPC UA value changes. You see the same behavior if you use a toggle button outside the compound widget.

I have not tried this, but I believe you must connect the bindable property to a local property, then watch the value changed event for this local property
Local properties

and if that value changes, call the SetValue action of your btnSwitch

Stephan

@Stefan_Ruttimann

I assume it’s something like this?

2025-11-24_16-36-52

ToggleButton and ToggleSwitch are in one compound widget.

In a case like yours when you don’t get the event from OpcUa changes I use a helper widget with an event that reacts to changes I need, like from a binding.
For example the ToggleButton EnableChanged is triggered on a binding change as well action like SetEnable.
So I use that to get myself the EnableChanged event to SetValue on the ToggleSwitch. The helper widget is set to invisible so you don’t see it online.

1 Like

Thanks guys I think this is the way to go.

In my special case I found a way easier solution. Because all I wantd was that the ToggleSwitch “BtnSwitch” follows the value of ToggleButton “Button”.

Now I just mapped the value of “BtnSwitch” to the same bindableProperty as “Button” is. So if the “Button” changes its value it changes the value of the bindesd OPC UA variable which then changes the value of the “BtnSwitch”. And also if I just change the OPC UA Variable in the watch, the “BtnSwitch” follows.

1 Like