Gateway scope and client scope

Hello,
I would like to control the buton’s visibility from a opc tag change
In the gateway tag change script i use the folowing code:
topDebutProd = system.tag.read(“QMP_rebox_2208/comPLC/topDebutProd”).value
BTvalide=system.gui.getWindow(“Accueil”).getRootContainer().getComponent(‘BT_lancementProd’)
if topDebutProd:
BTvalide.Visible=0
else:
BTvalide.Visible=1
But it seems the gateway can not reach the system.gui witch depend to the vision client…
Is there a way to do that?

Do not do this in a tag change event. In your project, make a custom property on your button and bind the tag to this property. Then in the buttons property change event do

If event.propertyName == 'yourCustomPropName':
    Do something

Thank you for your quick answer. The button has a property visible but when i bind it to my tag, the buton is visible when my tag is true , i would like the opposite and didn’t find option to do that.
I have already a tag change event on this tag that is why i thought to control the vivibility by script
Anyway if it is not possible i will try your method. By

Just bind your visible property to the expression:

!{QMP_rebox_2208/comPLC/topDebutProd}

I have tried:
!{QMP_rebox_2208/comPLC/topDebutProd}
or
!{“QMP_rebox_2208/comPLC/topDebutProd”}
or
<>!{QMP_rebox_2208/comPLC/topDebutProd}
or
![default]QMP_rebox_2208/comPLC/topDebutProd.value
And many more but it always tell me: You must specify a tag or tag property…

Are you writing that into an expression binding or a tag/indirect tag binding? A tag binding only accepts a tag path, no transformations. The expression I said can only be used in an expression. If in Perspective, you could use a tag binding to read the tag value and then apply an expression transform to negate it, or you could just use an expression binding in either vision or perspective

1 Like

OK finaly I have understood… thank you very much for the tip it works