# Dual Window behavior issue

**URL:** <https://forum.inductiveautomation.com/t/dual-window-behavior-issue/110390>\
**Category:** Ignition\
**Tags:** ignition81, vision, scripting\
**Created:** [September 4, 2025, 7:45pm UTC](https://forum.inductiveautomation.com/t/dual-window-behavior-issue/110390 "2025-09-04T19:45:06Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![nathaniel.brooks](https://avatars.discourse-cdn.com/v4/letter/n/df788c/32.png) [@nathaniel.brooks](https://forum.inductiveautomation.com/u/nathaniel.brooks)\
**Post date:** [September 4, 2025, 7:45pm UTC](https://forum.inductiveautomation.com/t/dual-window-behavior-issue/110390/1 "2025-09-04T19:45:06Z")

</div>

So I have a script that works 100% of the time on the main screen but where systems with multiple monitors are involved the second monitor only opens the window I want but doesn’t set the list box indices the way I want them.. except when I have my debug message box running. I’ve swapped out using screen info for a client tag with the index I want thinking that was it and I tried a lot of things to no avail. Here is a screen shot. Thank you in advance, i have circled my little debug box.

```python
def onDoubleClick(self, rowIndex, colIndex, colName, value, event):
    wlist = system.gui.getOpenedWindows()
    for w in wlist:
        system.gui.messageBox(str(w), "Derp")

    if rowIndex != -1:
        # Get the dataset from the table
        data = self.data
        # Get the value from the first column (index 0) of the clicked row
        value = data.getValueAt(rowIndex, 0)
        #Write this number to the list box on the drum inspection screen since its a list of drum starting at 1 and the index starts at zero the value needs to be -1
        system.tag.writeBlocking('[client]ScadaNavigation/DrumSelectLime', value)
        system.nav.openWindowInstance("Popup windows/Loft/DrumInspectionScreen")
        targetwindow = system.gui.getWindow("Popup windows/Loft/DrumInspectionScreen")
        drumno = targetwindow.getComponentForPath('Root Container.lbo_Drums')
        ds = system.tag.readBlocking('[client]ScadaNavigation/DrumSelectLime')
        drumno.selectedIndex = int(ds[0].value)-1

```

---

<div class="post-metadata">

**Author:** ![ryan.white](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/ryan.white/32/73193_2.png) [@ryan.white](https://forum.inductiveautomation.com/u/ryan.white)\
**Post date:** [September 4, 2025, 7:58pm UTC](https://forum.inductiveautomation.com/t/dual-window-behavior-issue/110390/2 "2025-09-04T19:58:00Z")

</div>

[`system.nav.openWindowInstance`](https://www.docs.inductiveautomation.com/docs/8.1/appendix/scripting-functions/system-nav/system-nav-openWindowInstance#returns) returns a reference to the newly opened window, use that reference instead of calling `system.gui.getWindow`, like such:

```python
targetWindow = system.nav.openWindowInstance("Popup windows/Loft/DrumInspectionScreen")

```

Additionally, don't write to and then read from the same tag in the same script. Use variables to store temporary data, that's what they do. The assignment to `drumno.selectedIndex` can be simplified to `drumno.selectedIndex = value - 1`, and the call to `system.tag.readBlocking` can be removed.

Overall your code can be simplified to the following (with more descriptive names for the variables):

```python
def onDoubleClick(self, rowIndex, colIndex, value, event):
	if rowIndex == -1:
		return

	tableData = self.data
	firstColValue = tableData.getValueAt(rowIndex, 0)
	system.tag.writeAsync(["[client]ScadaNavigation/DrumSelectLime"], [firstColValue])
	newPopup = system.nav.openWindowInstance("Popup windows/Loft/DrumInspectionScreen")
	drumNoComponent = newPopup.getComponentForPath("Root Container.lbo_Drums")
	drumNoComponent.selectedIndex = firstColValue - 1

```

Side note: Pictures are great for context, but post code as preformatted text. It makes it easier for others to parse and allows copy/paste instead of trying to decipher a picture. Please see [Wiki - how to post code on this forum](https://forum.inductiveautomation.com/t/wiki-how-to-post-code-on-this-forum/77831). You can edit your post by clicking the pencil icon in the bottom right.

EDIT: Added cleaned code, corrected `selectedIndex` assignment example

---

<div class="post-metadata">

**Author:** ![ryan.white](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/ryan.white/32/73193_2.png) [@ryan.white](https://forum.inductiveautomation.com/u/ryan.white)\
**Post date:** [September 4, 2025, 8:12pm UTC](https://forum.inductiveautomation.com/t/dual-window-behavior-issue/110390/3 "2025-09-04T20:12:04Z")

</div>

Actually, if you are going through the effort of opening a new window instance, why not pass the selected drum number to the new window instance via parameters? e.g.

```python
system.nav.openWindowInstance(
	"Popup windows/Loft/DrumInspectionScreen", {"selectedDrum": value-1}
)

```

From there, bind your list box's `selectedIndex` to that parameter on the window.

This would simplify your code further to just

```python
def onDoubleClick(self, rowIndex, colIndex, value, event):
	if rowIndex == -1:
		return

	# Grab Table data
	tableData = self.data
	# Grab value of first column in selected row
	firstColValue = tableData.getValueAt(rowIndex, 0)
	system.tag.writeAsync(["[client]ScadaNavigation/DrumSelectLime"], [firstColValue])
	system.nav.openWindowInstance(
		"Popup windows/Loft/DrumInspectionScreen", {"selectedDrum": firstColValue -1 }
	)

```

> **[Parameterized Popup Windows | Ignition User Manual](https://www.docs.inductiveautomation.com/docs/8.1/ignition-modules/vision/vision-windows/popup-windows/parameterized-popup-windows#passing-parameters-to-a-popup-window)**
>
> A parameterized popup window lets you pass parameters from one window into a popup window, where the receiving popup window could then use that parameter to display relevant information. This also allows you to maintain a single window that can be...

---

<div class="post-metadata">

**Author:** ![nathaniel.brooks](https://avatars.discourse-cdn.com/v4/letter/n/df788c/32.png) [@nathaniel.brooks](https://forum.inductiveautomation.com/u/nathaniel.brooks)\
**Post date:** [September 4, 2025, 8:26pm UTC](https://forum.inductiveautomation.com/t/dual-window-behavior-issue/110390/4 "2025-09-04T20:26:02Z")

</div>

Thank you for your reply. I’m still new to ignition but have some familiarity with python 3 working backwards. I’ve tried your suggestions and there are some issues but its probably because I was too brief in my description. I have a main screen which is a drum status screen which has a table on it.

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/7/7/77605ace4678b7525d4cfc394e3413db12f6abf8.png)

The idea is, id select from this and get the first column and it would populate the box here.

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

I havent tried the parameter yet because I didnt know I could do that.. but I like it.

The issue I have had is when I tried your suggestions a few things happened.  
First I got rid of the getwindow line in lieu of keeping the WindowInstance line thinking that in my general fatigue I must be getting redundant but while this opens the window without both lines of code on the main screen it doesn’t select the drum clicked on the other page. To have it open and to select the drum I want it seems to require that I have both lines of code right now.

Next I tried the reading and writing on the same script and using a variable. I already had a variable so I used that and I didnt need all that extra, I was over thinking it, thank you.

I commented out my code block to try the one you did. Unfortunately, while there were no errors, nothing happened. I like the way it looks though and this is a good exercise for me so I’ll see what I can do with it.

Lastly, when I ran my edited code with everything I could make work, the secondary screen for the dual monitor set up only fully works when I have my screen noting message box running It will open the window but not select the right drum . I used this for the Main screen to make sure my docks are showing up right.  
Thank you again for your help so far, I’ll continue working through this and am happy for any feedback.

---

<div class="post-metadata">

**Author:** ![ryan.white](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/ryan.white/32/73193_2.png) [@ryan.white](https://forum.inductiveautomation.com/u/ryan.white)\
**Post date:** [September 4, 2025, 8:33pm UTC](https://forum.inductiveautomation.com/t/dual-window-behavior-issue/110390/5 "2025-09-04T20:33:18Z")

</div>

> [@nathaniel.brooks](#):
>
> I havent tried the parameter yet because I didnt know I could do that.. but I like it.

Based on your description, this is the correct approach to this problem.

> [@nathaniel.brooks](#):
>
> Unfortunately, while there were no errors, nothing happened

Ah, capitalization issue, I used `Popup Windows` where you are using `Popup windows`

---

<div class="post-metadata">

**Author:** ![nathaniel.brooks](https://avatars.discourse-cdn.com/v4/letter/n/df788c/32.png) [@nathaniel.brooks](https://forum.inductiveautomation.com/u/nathaniel.brooks)\
**Post date:** [September 4, 2025, 8:33pm UTC](https://forum.inductiveautomation.com/t/dual-window-behavior-issue/110390/6 "2025-09-04T20:33:45Z")

</div>

I found the issue. Yes that was it.

---

<div class="post-metadata">

**Author:** ![ryan.white](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/ryan.white/32/73193_2.png) [@ryan.white](https://forum.inductiveautomation.com/u/ryan.white)\
**Post date:** [September 4, 2025, 8:43pm UTC](https://forum.inductiveautomation.com/t/dual-window-behavior-issue/110390/7 "2025-09-04T20:43:45Z")

</div>

Also, if you haven't already, take a look at [Inductive University](https://inductiveuniversity.com/courses/ignition/ignition-overview/8.1), it has a lot of free videos that cover the basics of using and designing in Ignition

> **[Parameterized Popup Window Video at Inductive University](https://inductiveuniversity.com/videos/parameterized-popup-window/8.1)**
>
> Learn how to create parameterized popup windows that can be re-used for multiple objects depending on the values that were passed in.

The [user manual](https://www.docs.inductiveautomation.com/docs/8.1/appendix/scripting-functions) is also a good resource to crawl through

---

<div class="post-metadata">

**Author:** ![nathaniel.brooks](https://avatars.discourse-cdn.com/v4/letter/n/df788c/32.png) [@nathaniel.brooks](https://forum.inductiveautomation.com/u/nathaniel.brooks)\
**Post date:** [September 4, 2025, 9:20pm UTC](https://forum.inductiveautomation.com/t/dual-window-behavior-issue/110390/8 "2025-09-04T21:20:46Z")

</div>

Thank you again,

I might have missed something I went through and made the custom property for “selectedDrum” I bound it to the selected Index property. When I run it the screen doesnt recognize that it is there. Did I put it in the wrong place?

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/a/f/af9fd6ce1e1097d9273a96e15c5d1e4f019e87c4.png)

---

<div class="post-metadata">

**Author:** ![ryan.white](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/ryan.white/32/73193_2.png) [@ryan.white](https://forum.inductiveautomation.com/u/ryan.white)\
**Post date:** [September 4, 2025, 9:41pm UTC](https://forum.inductiveautomation.com/t/dual-window-behavior-issue/110390/9 "2025-09-04T21:41:52Z")

</div>

Check capitalization/spelling of the custom property, and ensure that the custom property is on the root container of the `DrumInspectionScreen`. Also make sure that you have saved the project after all these changes.

---

<div class="post-metadata">

**Author:** ![nathaniel.brooks](https://avatars.discourse-cdn.com/v4/letter/n/df788c/32.png) [@nathaniel.brooks](https://forum.inductiveautomation.com/u/nathaniel.brooks)\
**Post date:** [September 4, 2025, 9:43pm UTC](https://forum.inductiveautomation.com/t/dual-window-behavior-issue/110390/10 "2025-09-04T21:43:25Z")

</div>

That was it . I put it on the listbox and not the root container. Thank you
