Custom Menu Navigation Help

I am working on my very 1st Ignition project! I have a popup window with buttons to link to the various full screen displays. I am trying to create a Template with two parameters: WindowToShow and ButtonLabel (both Strings). I can not for the life of me get a simple script of system.nav.SwapTo() to work at all. I even tried changing the script so that it just closed the popup window. That didn’t work. I have figured out is something to do with “focus” I believe? I have a button on the actual popup window that hides itself, and it works fine. I must be missing something by trying to create a template that doesn’t know how to reach out to the rest of Ignition to tell it what to do.

In essence, I am trying to use the Mouse/Pressed action. I want it to swap the main window with the one passed into the template as WindowToShow, and then hide itself (the menu popup).

Any help will be greatly appreciated! After 20 years of Wonderware I see LOTS of potential for Ignition, so I want to learn to do it right!

Do you have no action selected on the navigation tab? If not it will overwrite your script. I tried it on the templates mouse pressed event handler and it works.

windowToShow = event.source.WindowToShow
system.nav.swapTo(windowToShow, params)

Thank you for the quick response. I tried just as you indicated, with no luck. There is no scripting on the components within my template, and I verified “No Action” was selected. I am attaching a screen shot of what I have. I have also verified that I do, in fact, have a window named “FS Raw Water” which is the parameter set for the template. I’ve check that part a hundred times.

I actually managed to figure out what was not working. It turns out it was a “layering” type issue. I had a .PNG image of the button in the background with the scripting, but on top of that was the Label with the “ButtonLabel” value. The only scripting on the Label changes the color of the text on MouseEntered and MouseExited. There was no other scripting for any navigation.

I guess since the text label size was about the same size as the background image, it somehow prevented actually clicking on the background image. I just move the scripting to the actual label itself and everything works!

Thank you again for your assistance. It’s been a real headache trying to figure this one out, but I sure learned a lot more about Ignition in solving the problem!