Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Scripting_function


Panel
titleDescription

Performs a window swap from the current main screen window to the window specified. Swapping means that the opened window will take the place of the closing window - in this case it will be maximized. See also Navigation Strategies.

This function works like system.nav.swapWindow except that you cannot specify the source for the swap

Client permissions restrictions


Panel
titleSyntax

system.nav.swapTo(path, [params])

  • Parameters

String path - The path of a window to swap to.

Dictionary[String, Any] params - A dictionary of parameters to pass into the window. The keys in the dictionary must match dynamic property names on the target window's root container. The values for each key will be used to set those properties. [optional]

  • Returns

Window A reference to the swapped-to window. Refer to the list of window objects.

  • Scope

Vision Client

Panel
titleCode Examples
Code Block
languagepy
titleCode Snippet
# This code would go in a button's ActionPerformed event to swap out of the current window and into a window named MyWindow
system.nav.swapTo("MyWindow")
Code Block
languagepy
titleCode Snippet
# This code would go in a button's ActionPerformed event to swap out of the current window and into a window named MyWindow. 
# It also looks at the selected value in a dropdown menu and passes that value into the new window.
 
# MyWindow's Root Container must have a dynamic property named "paramValue"
dropdown = event.source.parent.getComponent("Dropdown")
system.nav.swapTo("MyWindow", {"paramValue":dropdown.selectedValue})
Code Block
languagepy
titleCode Snippet
#This code cycles through a dictionary of windows. This could be placed on a Client Event Timer Script to cycle through some windows.
#The below code assumes that each of the windows are in the same folder (named "Main Windows")
#If the windows are in different folders, then the script would need to be modified to prepend the correct folder name on the last line of code.

 
#Build a dictionary of window names without directories.
windowDict = {"Overview":"Motors", "Motors":"Alarming", "Alarming":"Scripting", "Scripting":"Overview"}
#Find the current window
currentWin = system.nav.getCurrentWindow()
winObj = system.gui.getWindow(currentWin)
#Find the next window in the dictionary based on the name of the current window (winObj)
nextWindow = windowDict[winObj.name]
#Swap to the next window
system.nav.swapTo("Main Windows/" + nextWindow)
Panel
titleKeywords

system nav swapTo, nav.swapTo