I want to show a popup when one of my tag is true.
I've tried binding the tag to ta custom property in a view screen and then do a under a change script: I added just: system.perspective.openpop(viewpath). By doing so, when I turn on the bool, I got an error.
Error running property change script on view.custom.OpenPopup: Traceback (most recent call last): File "function:valueChanged", line 3, in valueChanged at com.inductiveautomation.perspective.gateway.script.PerspectiveScriptingFunctions.openPopup(PerspectiveScriptingFunctions.java:238) at jdk.internal.reflect.GeneratedMethodAccessor57.invoke(Unknown Source) at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.base/java.lang.reflect.Method.invoke(Unknown Source) java.lang.IllegalArgumentException: java.lang.IllegalArgumentException: 'view' argument must be provided.
com.inductiveautomation.ignition.common.script.JythonExecException
Traceback (most recent call last):
File "function:valueChanged", line 2, in valueChanged
java.lang.IllegalArgumentException: java.lang.IllegalArgumentException: 'view' argument must be provided.
caused by org.python.core.PyException
Traceback (most recent call last):
File "function:valueChanged", line 2, in valueChanged
java.lang.IllegalArgumentException: java.lang.IllegalArgumentException: 'view' argument must be provided.
caused by IllegalArgumentException: 'view' argument must be provided.
Ignition v8.1.33 (b2023101913)
Java: Azul Systems, Inc. 17.0.8
You need to bind the tag you want to watch/trigger the popup to a custom property on either your perspective session or view, and then use a value changed script on that property to open the popup.
If you bind on the session property, you'll need to use a message handler to send an open window message to the currently open view, which will need to have the associated message handler defined.
You need to supply a popup Id as well as the path to the popup view.
def valueChanged(self, previousValue, currentValue, origin, missedEvents):
if (not previousValue or not previousValue.value) and currentValue.value:
system.perspective.openPopup("_pChecklist", "Popup/Checklist")
Thanks Mate. Got it to open the popup. How about when the tag goes to false and close out the popup? I tried the else statement but that doesn't seem to work.
def valueChanged(self, previousValue, currentValue, origin, missedEvents):
if (not previousValue or not previousValue.value) and currentValue.value:
system.perspective.openPopup("_pChecklist", "Popup/Checklist")
elif (not previousValue or previousValue.value) and not currentValue.value:
system.perspective.closePopup("_pChecklist")