How to prevent a window from participating in the back navigation

I’m using a redirect window (no graphics, just a script that looks at what kind of UDT was passed in and navigates to the appropriate window for that type of UDT. The problem is that it breaks the Back button functionality (now when you go back, you get to the redirect page which redirects you right to where you just were, and it’s faster than I can click…). Is there any way to say “don’t include this window in the back/forward navigation” or some way to pop it off the stack with a script? Or some way to detect that the navigation action is the result of the back button press and redirect the other way?


I have never tried using the back / forward navigation, but after looking at the documentation on the back script function (system.nav.goBack()) I see that it returns a PyObject of the window that it is going to.

I think if I was doing this I would try comparing the PyObject to something, and if it == the redirect window, then I would run the back function again. Something like this:

window = system.nav.goBack()
if window == redirect:

I’m not sure how to get the redirect object to compare it to. You might try starting here for that part:

I think that you may find that the scripting in the redirect window gives you another hurdle for this solution. If so than maybe try to delay the redirect window script very briefly. (Try using system.util.invokeLater()).

I hope this helps, and I would be glad to know how it turns out!

Good idea. Here’s how it ended up working:

I had to use a flag client tag called Navigation/Reverse_Redirect because I was already using system.util.invokeLater for the redirect and that was… later-er than my back button, if that makes sense (it would go back, then back, then the redirect would execute and I’d end up back where I was). So with that in mind, here’s what’s on the back button:

prevWindow = system.nav.goBack()
if 'Redirect' in prevWindow.getPath():
	system.tag.write('[Client]Navigation/Reverse_Redirect', True)

I found the getPath() function by doing a print dir() on the returned object.

On the redirect windows, in an internalFrameActivated script:

def nav():
	if'[Client]Navigation/Reverse_Redirect').value == True:
		system.tag.write('[Client]Navigation/Reverse_Redirect', False)
		path = system.gui.getParentWindow(event).getComponentForPath('Root Container').GCPath
		type = str('/Type').value)
		system.nav.swapTo('Auto_Graphics/GC/'+type, {'GCPath': path})

If the back action detects that it’s going to a redirect screen (there are several, but they are all named Redirect), it sets the Reverse_Redirect flag. The redirect screens look for this flag before doing their redirect; if it is True, the redirect screen itself does the second back navigation.

This seems to work well. Thanks for the pointer!