--- title: "system.nav.swapWindow" description: "Performs a window swap." --- # system.nav.swapWindow > Performs a window swap. This function is used in **Python Scripting**. ## Description Performs a window swap. This means that one window is closed, and another is opened and takes its place - assuming its size, floating state, and maximization state. This gives a seamless transition - one window seems to simply turn into another. This function works like [system.nav.swapTo](system-nav-swapTo.md), except that you can specify the source and destination for the swap. ## Client Permission Restrictions This scripting function has no Client Permission restrictions. ## Syntax #1 (String param) `system.nav.swapWindow(swapFromPath, swapToPath, [params])` ### Parameters Type | Parameter | Description ------- | ------- | ------ String| `swapFromPath` | The path of the window to swap from. Must be a currently open window, otherwise this will act like an openWindow. String| `swapToPath` | The name of the 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. ### Scope Vision Client ## Syntax #2 (EventObject param) `system.nav.swapWindow(event, swapToPath, [params])` ### Parameters Type | Parameter | Description ------- | ------- | ------ EventObject| `event` | A component event whose enclosing window will be used as the "swap-from" window. String| `swapToPath` | The name of the 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 window that was navigated to. Refer to the list of window objects. ### Scope Vision Client ## Code Examples ```python title="Example #1" # This code would go in a button's ActionPerformed event to swap out of the # window containing the button and into a window named MyWindow. system.nav.swapWindow(event, "MyWindow") ``` ```python title="Example #2" # This code would swap from window named WindowA to a window named WindowB. system.nav.swapWindow("WindowA", "WindowB") ``` ```python title="Example #3" # This code would swap from window named WindowA to a window named WindowB. # It also looks at the two calendar popup controls and passes the two selected # dates to WindowB. WindowB's Root Container must have dynamic properties named # "startDate" and "endDate". date1 = event.source.parent.getComponent("Start Date").date date2 = event.source.parent.getComponent("End Date").date system.nav.swapWindow("WindowA", "WindowB", {"startDate":date1, "endDate":date2}) ```