system.nav.swapTo not closing the previous docked window

I’m creating an application on an old 7.8 server. (I know … but it’s not mine.)

  • All the windows are docked.
  • The menubar is set to West.
  • All the other windows are set to “East”.
  • When start the application only the menubar appears on the left.
  • When I click the button for the first window it pops up on the east as expected but with a large gap between it and the menubar.
  • Selecting additional menu buttons opens up the additional windows but they all get attached on the east nudging the previous windows further and further off the screen. I can close them all with the Ignition Window menu.
  • The Event Handlers - action - actionPerformed is generated by the Navigation option and the resultant code for each button looks like this:
# This script was generated automatically by the navigation
# script builder. You may modify this script, but if you do,
# you will not be able to use the navigation builder to update
# this script without overwriting your changes.

system.nav.swapTo('Docked windows/EC Temperatures')

Can anyone remember back to 7.8.2 to advise me what the problem might be?

Many thanks.

swapTo has not ever been intended for use with docked windows; it’s designed to close a detected “Main” window and replace it with a new one. I’m struggling to find the use case for all windows being docked, but, I suspect you’ll have to write your own swap function that closes anything besides your docked menubar, then opens the passed in window.

Thanks for that, Paul.

What’s the right way then? Should I convert the menu window into a template and add that to each page, treating each as a main window?

If you’ve already got your windows laid out they way they should be, you shouldn’t need a great deal of effort. Just change the window properties such that your current east-docked windows match the ‘expected’ settings for main windows: https://docs.inductiveautomation.com/display/DOC80/Window+Types, and swapTo should start working.

That was it, thanks, Paul.
Thank you for your time.

1 Like