How do I check in verse if a capture area device changed its control?

I’m new to this, all I did until now was to subscribe using the ControlChangeEvent, but I do not know how to actually check it on an if statement

OnBegin():void=
capAreaD.ControlChangeEvent.Subscribe(OnControlChange)

OnControlChange(Agent: agent) : void =
if …

I created a trigger device and put to trigger when the capture area change it’s control

Then in code, added:

OnBegin():void=
triggerD.TriggeredEvent.Subscribe(OnControlChange)

OnControlChange(newAgent: ?agent): void =
NewUI := MakeUI_A()
NewUI.SetVisibility(InVisibility := widget_visibility.Hidden)

(i want to hide a widget when the control change)

There’s no error in the code, but it’s not working. I did put a print in the OnControlChange to debug, but it don’t even print a message