Unexpected system.nav.swapWindow() Behavior

I have the following scenario in which swapWindow() is not acting as I expect it to:

My project contains an overview screen showing individual devices. The user can click on a device to open an information screen. All devices open the same information screen that is configured for the specific device through a passed parameter used in the internalFrameActivated script. The following script opens the information screen:

system.nav.openWindow('Tubular_Press_Info', {'press_number' : event.source.parent.Press_ID})
system.nav.centerWindow('Tubular_Press_Info')

This works fine and as I expect.

Within the information screen, I am adding navigation buttons to allow the user to switch between devices using the following event script:

[code]import app.pressnav.nav.nextPress

currentWindow = system.gui.getParentWindow(event).name
system.nav.swapWindow(currentWindow, ‘Clincher_Press_Info’,
{‘press_number’ : app.pressnav.nav.nextPress(event.source.parent.press_number)})[/code]
The idea is to avoid having to close the information screen and then reopening it by clicking on a different device. My problem is that when navigating “back” to the window in this way, the internalFrameActivated script does not get fired and the window isn’t configured for the new press_number.

My questions:

  1. Is this a bug or expected/featured behavior?
  2. Is there an easy way to fire the internalFrameActivated event within my code? Something like:

[code]import app.pressnav.nav.nextPress

currentWindow = system.gui.getParentWindow(event).name
system.nav.swapWindow(currentWindow, ‘Clincher_Press_Info’,
{‘press_number’ : app.pressnav.nav.nextPress(event.source.parent.press_number)})

Fire internalFrameActivated event

[/code]

Thanks.

I don’t think you need to do all that scripting.

For the popup window, you should be able to switch between presses just by setting the ‘press_number’ dynamic property, that is, if your window components are bound to things based on that property. Your back and forward buttons should be able to cycle through values of ‘press_number’, which will update everything when the value changes automatically.

The last minute of this video on navigation brush over parameter passing. The whole video should present some idea on how navigation is intended. It’s a bit old (2008) so the look and terminology will be a bit dated, but the same principals apply.

To answer your questions:

  1. The internalFrameActivated event fires when a window first opens. I believe that behavior is expected.
  2. I’m not sure whether you can force an event to fire (developers…?). However, there are other ways to achieve what you’re going for.

I could simply set the press_number and most of the screen would update. However, the point of calling the swapWindow() method is to get the internalFrameActivated event to fire which sets up pens on an easychart.

The main reason for asking the question was to better understand Ignition and to find out if this is working correctly. From the documentation, I expected swapWindow() to cause internalFrameActivated to fire in this case. It seems it does not.

The internalFrameActivated event fires anytime the window gets focus: either from opening or selecting the window.