Internal frame activated timing

Hi all,

I have a project where I open a header, main window and a navigation strip on startup.
In my header I have several dynamic sparkline charts that display different trends for the last 24 hours. When I open a different window, the sparklines changes to some relevant trends for that specific window.

With the “internalFrameActivated” I use the following code snippet to change the tagpath to the sparkline charts:

desktop = system.gui.getCurrentDesktop()
window = system.gui.desktop(desktop).getWindow(‘Screens/Header’)
window.getRootContainer().getComponent(“Group”).getComponent(“Sparkline Chart”).tagPath = “tagpathToSomeTag”

The sparkline charts updates fine. But it seems to be some kind of timing issue by doing it like this. When I save my project and press the “Project update available”-strip, I get a script evaluation error popup explaining me that “The window “Screens/Header” is not currently open”. Despite it is set to open on startup, and is clearly already open.

Is the “internalFrameActivated” event firing before the windows are opened on startup?

Anyone knows how to avoid this error to keep showing?

Ignition version 8.0.9
Win 10

Is it possible for you to remove the entire internalFrameActivated script and use a Indirect Tag Binding on the Sparkline Charts’ tagPath property?

In such case, how am I going to change the sparkline tagPaths when changing windows? The internalFrameActivated is triggered each time a window is opened, and is why I used it to send new tagpaths to the different sparklines.

I see your point. I know I’m avoiding your original question but is it possible to pass in a tagPath to your sparkline chart windows and just use a binding this way?

1 Like

You can wrap it in a try/except block. This example will just ignore the error, but it does give the option of doing something in case of an exception.

try:
	desktop = system.gui.getCurrentDesktop()
	window = system.gui.desktop(desktop).getWindow('Screens/Header')
	window.getRootContainer().getComponent('Group').getComponent('Sparkline Chart').tagPath = 'tagpathToSomeTag'
except:
	pass

The strange thing is that the sparkline charts gets updated every time we open a new window despite the error popping up saying the header is not currently open.
The try/except block prevents the error to pop up on the clients.

Works great, thanks! :slight_smile: