# Swap Function not Working

**URL:** <https://forum.inductiveautomation.com/t/swap-function-not-working/68052>\
**Category:** Ignition\
**Tags:** vision\
**Created:** [December 29, 2022, 2:00am UTC](https://forum.inductiveautomation.com/t/swap-function-not-working/68052 "2022-12-29T02:00:55Z")\
**Posts on this page:** 17\
**Page:** 1

<div class="post-metadata">

**Author:** ![Charles\_Bustilos](https://avatars.discourse-cdn.com/v4/letter/c/a87d85/32.png) [@Charles\_Bustilos](https://forum.inductiveautomation.com/u/Charles_Bustilos)\
**Post date:** [December 29, 2022, 2:00am UTC](https://forum.inductiveautomation.com/t/swap-function-not-working/68052/1 "2022-12-29T02:00:55Z")

</div>

I'm learning Ignition, I'm creating my first project an so far I'm having issues with something that supposed to be an easy task, "Navigation". The swap function does not work for me. I have three main screens in my project. They are set to "Start maximized" the false check box is empty. I tried the Tab Navigation and also the regular button and still opening all the screens one underneath the other one, so if I scroll down I see all three. I'm trying to do the transition between Factory Talk to Ignition but why this task is so difficult is very easy in factory talk. What do I'm doing wrong?

---

<div class="post-metadata">

**Author:** ![justinedwards.jle](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/justinedwards.jle/32/37854_2.png) [@justinedwards.jle](https://forum.inductiveautomation.com/u/justinedwards.jle)\
**Post date:** [December 29, 2022, 2:12am UTC](https://forum.inductiveautomation.com/t/swap-function-not-working/68052/2 "2022-12-29T02:12:43Z")

</div>

> [@Charles\_Bustilos](#):
>
> why this task is so difficult i

I'm not sure. With ignition, I've always found this to be simple. Just for clarification, is this a Vision project or Perspective? Also, how are are you swapping? is it from navigation buttons? Is there code you're using for the swaps? if there is code involved, please post it.

---

<div class="post-metadata">

**Author:** ![Charles\_Bustilos](https://avatars.discourse-cdn.com/v4/letter/c/a87d85/32.png) [@Charles\_Bustilos](https://forum.inductiveautomation.com/u/Charles_Bustilos)\
**Post date:** [December 29, 2022, 2:23am UTC](https://forum.inductiveautomation.com/t/swap-function-not-working/68052/3 "2022-12-29T02:23:30Z")

</div>

It's a vision project.  
I'm using a Button (first on the list of "Buttons") when I double click on it on the "Component Scripting pop out" I select "Action Performed" I selected open/swap and then Swap and the window name where I want to go to. No code. I also tried the "Tab Strip" component with the same result.

---

<div class="post-metadata">

**Author:** ![Charles\_Bustilos](https://avatars.discourse-cdn.com/v4/letter/c/a87d85/32.png) [@Charles\_Bustilos](https://forum.inductiveautomation.com/u/Charles_Bustilos)\
**Post date:** [December 29, 2022, 2:26am UTC](https://forum.inductiveautomation.com/t/swap-function-not-working/68052/4 "2022-12-29T02:26:05Z")

</div>

![Button](https://us1.discourse-cdn.com/inductiveautomation/original/3X/b/d/bdd5c3e2eb28a06e83f8f9b4c517884b25d5f343.png)

---

<div class="post-metadata">

**Author:** ![Charles\_Bustilos](https://avatars.discourse-cdn.com/v4/letter/c/a87d85/32.png) [@Charles\_Bustilos](https://forum.inductiveautomation.com/u/Charles_Bustilos)\
**Post date:** [December 29, 2022, 2:27am UTC](https://forum.inductiveautomation.com/t/swap-function-not-working/68052/5 "2022-12-29T02:27:54Z")

</div>

![window](https://us1.discourse-cdn.com/inductiveautomation/original/3X/5/f/5f697b157b1ebb791a93d7eb4b12ace0c04442d8.png)

---

<div class="post-metadata">

**Author:** ![Charles\_Bustilos](https://avatars.discourse-cdn.com/v4/letter/c/a87d85/32.png) [@Charles\_Bustilos](https://forum.inductiveautomation.com/u/Charles_Bustilos)\
**Post date:** [December 29, 2022, 2:37am UTC](https://forum.inductiveautomation.com/t/swap-function-not-working/68052/6 "2022-12-29T02:37:19Z")

</div>

The button only opens the new window but it does not close the opened window.

---

<div class="post-metadata">

**Author:** ![Charles\_Bustilos](https://avatars.discourse-cdn.com/v4/letter/c/a87d85/32.png) [@Charles\_Bustilos](https://forum.inductiveautomation.com/u/Charles_Bustilos)\
**Post date:** [December 29, 2022, 3:08am UTC](https://forum.inductiveautomation.com/t/swap-function-not-working/68052/7 "2022-12-29T03:08:57Z")

</div>

It works with floating windows with the maximized is set to true! However, it should also work with "Docked Windows", right? The only issue I seen is that with docked windows the check box does not work. There is any setting that I have to set to have the "Maximized" working. I had the impression that floating will be more for pop out windows.

---

<div class="post-metadata">

**Author:** ![Ryan\_Allen](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/ryan_allen/32/47013_2.png) [@Ryan\_Allen](https://forum.inductiveautomation.com/u/Ryan_Allen)\
**Post date:** [December 29, 2022, 3:11am UTC](https://forum.inductiveautomation.com/t/swap-function-not-working/68052/8 "2022-12-29T03:11:26Z")

</div>

Try using a mouse clicked event handler instead of action performed.

---

<div class="post-metadata">

**Author:** ![Charles\_Bustilos](https://avatars.discourse-cdn.com/v4/letter/c/a87d85/32.png) [@Charles\_Bustilos](https://forum.inductiveautomation.com/u/Charles_Bustilos)\
**Post date:** [December 29, 2022, 3:12am UTC](https://forum.inductiveautomation.com/t/swap-function-not-working/68052/9 "2022-12-29T03:12:27Z")

</div>

I'm going to try right now, thank you.

---

<div class="post-metadata">

**Author:** ![Ryan\_Allen](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/ryan_allen/32/47013_2.png) [@Ryan\_Allen](https://forum.inductiveautomation.com/u/Ryan_Allen)\
**Post date:** [December 29, 2022, 3:18am UTC](https://forum.inductiveautomation.com/t/swap-function-not-working/68052/10 "2022-12-29T03:18:14Z")

</div>

I think it does need to be floating for swap to work actually. Not 100% sure on that though

---

<div class="post-metadata">

**Author:** ![Charles\_Bustilos](https://avatars.discourse-cdn.com/v4/letter/c/a87d85/32.png) [@Charles\_Bustilos](https://forum.inductiveautomation.com/u/Charles_Bustilos)\
**Post date:** [December 29, 2022, 3:19am UTC](https://forum.inductiveautomation.com/t/swap-function-not-working/68052/11 "2022-12-29T03:19:57Z")

</div>

It does the same, it only works with "Floating Windows" with the Maximized "True", it's rare that it does not work for "Docked Windows" since is the default for "Main Windows".

---

<div class="post-metadata">

**Author:** ![Charles\_Bustilos](https://avatars.discourse-cdn.com/v4/letter/c/a87d85/32.png) [@Charles\_Bustilos](https://forum.inductiveautomation.com/u/Charles_Bustilos)\
**Post date:** [December 29, 2022, 3:21am UTC](https://forum.inductiveautomation.com/t/swap-function-not-working/68052/12 "2022-12-29T03:21:03Z")

</div>

I guess you are right

---

<div class="post-metadata">

**Author:** ![Charles\_Bustilos](https://avatars.discourse-cdn.com/v4/letter/c/a87d85/32.png) [@Charles\_Bustilos](https://forum.inductiveautomation.com/u/Charles_Bustilos)\
**Post date:** [December 29, 2022, 3:22am UTC](https://forum.inductiveautomation.com/t/swap-function-not-working/68052/13 "2022-12-29T03:22:36Z")

</div>

The manual does not mention that, or I missed that section

---

<div class="post-metadata">

**Author:** ![justinedwards.jle](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/justinedwards.jle/32/37854_2.png) [@justinedwards.jle](https://forum.inductiveautomation.com/u/justinedwards.jle)\
**Post date:** [December 29, 2022, 3:23am UTC](https://forum.inductiveautomation.com/t/swap-function-not-working/68052/14 "2022-12-29T03:23:07Z")

</div>

For docked windows, you can script it with `system.nav.swapWindow()` Use the button's actionPerfomed event handler.

The code will look like this:

```auto
system.nav.swapWindow("pathtoWindow/ThatCloses", "PathtoWindow/ThatOpens")

```

This video resource is perhaps easier to follow than the manual:

> **[Navigation Functions - Vision Windows and Scripting](https://inductiveuniversity.com/videos/navigation-functions/8.1)**
>
> Navigation Functions: Learn how to use the system.nav.\* functions to manipulate the windows inside a Vision Client. Learn the difference between swapTo and swapWindow. Learn more about Vision Windows and Scripting

What you are looking for is discussed at timestamp 04:00

---

<div class="post-metadata">

**Author:** ![Charles\_Bustilos](https://avatars.discourse-cdn.com/v4/letter/c/a87d85/32.png) [@Charles\_Bustilos](https://forum.inductiveautomation.com/u/Charles_Bustilos)\
**Post date:** [December 29, 2022, 3:23am UTC](https://forum.inductiveautomation.com/t/swap-function-not-working/68052/15 "2022-12-29T03:23:26Z")

</div>

I guess you are right, the manual does not mention that or I missed that section.

---

<div class="post-metadata">

**Author:** ![Charles\_Bustilos](https://avatars.discourse-cdn.com/v4/letter/c/a87d85/32.png) [@Charles\_Bustilos](https://forum.inductiveautomation.com/u/Charles_Bustilos)\
**Post date:** [December 31, 2022, 12:26am UTC](https://forum.inductiveautomation.com/t/swap-function-not-working/68052/16 "2022-12-31T00:26:57Z")

</div>

It Works! thank you for your help.

---

<div class="post-metadata">

**Author:** ![nminchin](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/nminchin/32/6911_2.png) [@nminchin](https://forum.inductiveautomation.com/u/nminchin)\
**Post date:** [December 31, 2022, 8:18am UTC](https://forum.inductiveautomation.com/t/swap-function-not-working/68052/17 "2022-12-31T08:18:02Z")

</div>

Perhaps your first introduction to ignition hasn't been as smooth as you would have liked, but once you sink your teeth in and start understanding it, I'm sure you'll excel
