Navigation buttons in templates

Hi everyone!
I’m creating a plant synoptique and I need to switch from a page to another to show different area of the plant.
I need to create probably 20 pages (Windows) so I’m creating some templates.
Every Windows of my project will contain a specific plant area and I want to put in every page some buttons (or a tab strip but, seems to be more difficult than button) to allow user to navigate in different area.
How can I set my buttons (inside templates) to have a different “action performed” event depending on what Windows is open?

(to create my pages I’m using template canvas where I put together different templates (machines, information about hours, this navigation buttons…)

Hope I made my point.

Thank you!!

I found an easy solution that allows me to navigate in pages but it could be cool for me also having the text on the template button, that changing depending by name of Windows.
(when I’m in the area 5, the buttons show me [go to area 4],[go to area 6],
when I’m the area 10,the buttons show me [go to area 9],[go to area 1].
Thank you

The “easiest” way is going to be to pass the “total” number of areas into the template, and bind the button text with an expression binding:

In this example, my “Bay” template receives two parameters: “area”, and “total”.
Button to Previous:

'Go to Area ' + (toInt({Bay.area}, 0) - 1)

Button to Next:

'Go to Area ' + if(toInt({Bay.area}, 0)>=toInt({}),1,(toInt({Bay.area}, 0) + 1))
1 Like

I have a side project that I’m working on for plant managers to navigate through the entire plant. I make the background of the window an image of the plant floor plan that was created in Autocad. Then using the drawing tools, I draw shapes around each department area and with no visible border. The shapes are basically invisible. With each department area shape I add script in the onMouseEntered/onMouseExit functions to change the background color of the shape. The user can move their mouse into each area and it will highlight the area and show a tooltip describing which area it is. When they click inside the shape area it navigates to a window specific to that area, which has a return button to navigate back to the floor plan.


There are actually a couple ways to do this depending on the naming convention of your windows. For example:

currentWin = system.nav.getCurrentWindow()
winName = system.gui.getWindow(currentWin)

(sample name)winName = “Bay Area 5”

win_sub = winName.split()
print win_sub[len(win_sub)-1]   

This will print 5 because it is the last part of the sample window name.

You could then set this equal to a custom property on the template button:

event.source.bayNum = "Go to Bay " + win_sub[len(win_sub)-1] #go to bay 5

If the name of the button text was then linked to this variable to depict it’s name, then you would have a dynamic button template.

1 Like