Vision - Closing a single instance of multi-instance popup on all clients

We have multiple instances of a popup that are displayed on the screen in set locations base on PLC tags. They are individually closed by the operator via a button script. The issue is that this only closes that one client’s popup and not the other open clients. We would like to have the ability to close a particular popup instance from all open clients via a PLC tag.

Here is the client TagCange script that launches the popups. Each channel has its own TagChange and location.

if newValue.value == 1:
window = system.nav.openWindowInstance(‘Popup Windows/Close Handle Warning’,{‘ChannelNumber’:‘01’})
window.setLocation(233,120)

Just not sure how to close individual ones now.

Just do the opposite in a new tagchange script that monitors a new plc or internal tag value for change which is set by the close button on the popup, and instead close the popup with system.nav.closeWindow

I added the “if tag==0” condition. No luck.
Although it compiled, I don’t think the code I have properly identifies the popup instance I want to close.

if newValue.value == 1:
window = system.nav.openWindowInstance(‘Popup Windows/Close Handle Warning’,{‘ChannelNumber’:‘01’})
window.setLocation(233,120)

if newValue.value == 0:
window = system.gui.getWindow(‘Popup Windows/Close Handle Warning’,{‘ChannelNumber’:‘01’})
system.nav.closeWindow(window)

You just need to use the window path:

   windowPath = 'Popup Windows/Close Handle Warning' 
   system.nav.closeWindow(windowPath) 
 

Otherwise, if you have multiple instances of the popup open and only want to close one of them (on all clients), then add a custom property to the popup which binds to your trigger tag, then use a property change script in the popup to close it (system.nav.closeParentWindow(event)) if the trigger turns off

1 Like

mmmm how the trigger tag?