Popup drama

ok, I have my popup set up with a template inside the popup window.
I have the template path bound to a client tag which changes according to an event handler script.
I also did this using the pass parameter option earlier and figured that it functions the same for me either way I do it.

Every time I load the popup, I want a particular template to be displayed, but instead it does not come up until I close the popup and activate it again.
For some reason if I try to manually change the client tag that controls the path, I can change it while the popup window is open.
I would like the client tag change to control the template path on launch.

system.nav.openWindow(‘popup’)
system.nav.centerWindow(‘popup’)

value = event.source.parent.name
system.tag.writeToTag(’[Client]SectionPop’, value)

I had these reversed… It will not work in the opposite order.

[quote=“BigSchottkyD”]system.nav.openWindow(‘popup’)
system.nav.centerWindow(‘popup’)

value = event.source.parent.name
system.tag.writeToTag(’[Client]SectionPop’, value)

I had these reversed… It will not work in the opposite order.[/quote]

Does anyone know why I can activate a window with the properties enabled that I pass ?

I am actually using the parameter that I passed from the event handler to this window which is displaying history of an indirect tag.

I am noticing that it is logging the past values with no regard taken to which motor is actually being addressed by the event handler.

I am switching my directions here and would like to see history of each motor on their own charts each time I open the window with the new motor parameter.

When you say that it is logging past values, are you talking about the realtime chart? Also, it looks like you’re binding the chart correctly, all you need to do is have each motor instance in the previous window pass its motorID to the popup and you should be good, where are you running into a problem?

One issue at a time. I tried to re-create your popup issue where a client tag holds the template path, with no luck. mine worked regardless of whether the writeToTag was before or after the navigation code. Can you create an SSCCE that demonstrates this issue? If you don’t know what an SSCCE is, please read this guide.

Now that i’ve upgraded to 7.5, my client tags were deleted and I cant make new ones. The option is greyed out.
Also, i’m experiencing more lag then ever.

This sounds like a separate issue that you should post in the Ignition Problems section of the forum.

OK.
I’ll post it there, but can I just ask in this thread, Why cant I link Template paths in windows to paramers that i pass in event scripts?
They only load the path on the second event. Using the write to tag works for me but is a bit unconventional since i’m also referencing report indirection by this passed parameter.

I'm sorry, I'm not quite understanding your issue.

This works for me, how exactly is this failing? The templatePath property is a string and can be bound using any of the usual binding types.
You should be passing parameters into the window like this:value = event.source.parent.name system.nav.openWindow('popup', {"MotorID":value}) system.nav.centerWindow('popup')And then you can use that MotorID anywhere in the popup window for your indirect paths.
On a semi-separate note, you should not be using a componenets 'name' property for any bindings. I would create a dynamic property on that component (called MotorID) that holds the string you want to pass to the popup window.

Is the second event 'opening the screen a second time'?

So you did get it to work on first time the popup is opened but you don't like that method because you are using it already to fill a report? I don't understand.

It works properly when I bind the template path to a tag (loads properly the first time I click the link)
However, I was hoping to avoid using the tag completely and only use the passed parameter than I am using elsewhere in the popup window to simplify the scripting.

It seems like it should work properly but I can make it work like this on the first event.

Perfect, just use this:value = event.source.parent.name system.nav.openWindow('popup', {"MotorID":value}) system.nav.centerWindow('popup')And make sure your 'MotorID' property has no binding to anything.

[quote="BigSchottkyD"]...but I can make it work like this on the first event.[/quote]So your problem is solved? Or did you mean to say "can't"? That makes a big difference!

Perfect, just use this:value = event.source.parent.name system.nav.openWindow('popup', {"MotorID":value}) system.nav.centerWindow('popup')And make sure your 'MotorID' property has no binding to anything.

Actually now, I cant get it to work anyway.
Perhaps we could get someone to look at my project and see what I'm doing wrong?

OK.
For some reason, using parameters does not work for me the first event.

I now AM able to make this work using a client tag which im assuming is actually slower? than by binding it to a property like I wanted.
The problem here was that I am linking this to a label inside of a template so I needed the parent.parent.name

I am okay for now on this, but i’d like to know why I’m not able to use a parameter for this

I replicated the issue you reported. You’re right: on first pass, the template wasn’t loading correctly.

This has been fixed for 7.4.4. In the meantime, you can use the following logic if you want to avoid the use of a client tag.

In this script I’m opening a popup window that has a root container property called “TemplatePath” on it. My template’s template path is bound to this root container property using a property binding. I’m setting it to a template called “T1”. This script will work correctly even without the fix in 7.4.4:

[code]window = system.nav.openWindow(‘Popup’)
system.nav.centerWindow(‘Popup’)

def setPath(window=window):
window.rootContainer.TemplatePath=‘T1’
system.util.invokeLater(setPath)[/code]

Here is the script I took from you.
It seems to work but when I remove the ‘template value’ and try to replace it with my own string I get an error that says
Traceback (most recent call last):
File “event:mouseReleased”, line 6, in setPath
NameError: global name ‘value’ is not defined
Ignition v7.5.0 (b1079)
Java: Oracle Corporation 1.7.0_04

Here is the script:
value = event.source.selectedTab
#link = str(value)
window = system.nav.openWindow(‘popuptier’)

def setPath(window=window):
window.rootContainer.TemplatePath= value
system.util.invokeLater(setPath)

That error is a result of the variable “value” not being defined within the scope it is being referenced in. You have to pass in the variable “value” into the function setPath:

value = event.source.selectedTab
#link = str(value)
window = system.nav.openWindow('popuptier')

def setPath(window=window,value=value):
	window.rootContainer.TemplatePath = value
system.util.invokeLater(setPath)

that got it,
thanks James