OPC tag to open a popup window in perspective

Hi

I’m just started to learn how to program in ignition perspective, so I apologize for the silly questions. I’m trying to open a popup window when a tag (from opc ua , but for testing Im using a bool memory ) changes status from off to on. I know there is a lot of topics related to this but all that I tried does not work and never opens a popup window.

I’m using ignition edge perspective.!.

I have read, the best option is to bind a property in my view to a tag and then set up a change script on that property to trigger the popup.

image

image405×144 7.84 KB

image

image1044×333 28.5 KB

image

image383×383 17.4 KB

image

image320×532 17.4 KB

My script:

def valueChanged(self, previousValue, currentValue, origin, missedEvents):
	if currentValue.value:
		system.perspective.openPopup("_PopUp_Test", "PopUp_Test")


I appreciate any help.

Thanks

I'm just checking that you're aware that Designer's limited browser emulation doesn't support navigation in general, and doesn't support popups in particular.

Have you tested it by running the view in a browser?

Tips:

  • You can also put a system.perspective.print() statement into your script. This will output to Designer's Console (at least you'll know the script ran in Designer - even if the popup doesn't).
  • It will also output to the browser's Developer Tools console. Hit F12 and find the Console tab.
2 Likes

Thank you for your reply.

Yes , I‘m awere of that and I’m running the view in a browser.

I’m using a trial version at the moment , do you think this can be an issue?.

Trial versions are fully functional.

Are you sure this is correct view path?

View path looks correct. As an aside, I do prefer to use keyword args instead of just relying on the index of them. They help to know exactly what you're passing into the function without relying on your memory or having to look it up each time, and they also help others avoid the same when you’re asking for help (I had to look up the order of args myself, despite having used it countless times).

In addition to adding a print statement as @Transistor suggested, I sometimes also add a label which binds to the custom prop to verify its actually showing the right value

It looks like it can be in parent folder though. Based on my preliminary investigation.

Where is your mypopup custom property located? If it is inside your popup's view and you are trying to open the popup from a different view in your browser, it will not work. Try placing mypopup in a session custom property. That way, mypopup will be available in your browser session regardless of which views are currently open.

No, a change script attached to a session custom prop only has session scope, and cannot open a popup. It needs to be a view custom prop. This is best placed on a shared dock view that is always present.

3 Likes