# Determining programmatically when window is finished opening

**URL:** <https://forum.inductiveautomation.com/t/determining-programmatically-when-window-is-finished-opening/6992>\
**Category:** Ignition\
**Created:** [August 6, 2013, 6:08pm UTC](https://forum.inductiveautomation.com/t/determining-programmatically-when-window-is-finished-opening/6992 "2013-08-06T18:08:42Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![lisawas](https://avatars.discourse-cdn.com/v4/letter/l/4bbf92/32.png) [@lisawas](https://forum.inductiveautomation.com/u/lisawas)\
**Post date:** [August 6, 2013, 6:08pm UTC](https://forum.inductiveautomation.com/t/determining-programmatically-when-window-is-finished-opening/6992/1 "2013-08-06T18:08:42Z")

</div>

I’m currently executing a long initialization script from the InternalFrameOpened event of the starting screen of my project. I use invokeAsynchronous to run my script on a background thread, and called invokeLater from that, periodically, to push new information to my screen. The problem is that sometimes, the screen updates appear to fire before the window is fully opened.

As a temporary fix, I polled system.gui.getOpenedWindowNames() until I found my window in it, but this seems like a nasty solution.

Is there something I can watch or do to ensure that my updates don’t stomp on the window opening?

---

<div class="post-metadata">

**Author:** ![lisawas](https://avatars.discourse-cdn.com/v4/letter/l/4bbf92/32.png) [@lisawas](https://forum.inductiveautomation.com/u/lisawas)\
**Post date:** [August 6, 2013, 6:42pm UTC](https://forum.inductiveautomation.com/t/determining-programmatically-when-window-is-finished-opening/6992/2 "2013-08-06T18:42:52Z")

</div>

What's even stranger is that it seems like the window is opening twice. Here's the contents of my console, with some traces that I added.

For reference, the confirmWindowOpen function runs as part of the initialization function, on the background thread. updateSplashText is run using invokeLater on the event-dispatch thread. The client tag information come from a client tag change script.

> [@](#):
>
> Creating frame. extendedState=6, bounds=java.awt.Rectangle[x=0,y=0,width=1024,height=768]  
> INFO [Gateway-Thread-16] Starting up polling tag manager, polling rate: 250 ms  
> INFO [ReportingClientHook-Thread-16] Starting up Reporting Module. Mode: Activated  
> Initializing ReportMill (Build Date: May-27-05, Version 9.0, JVM 23.25-b01, User lisawas)  
> INFO [ClientPanel-AWT-EventQueue-2] Received project change notification: notificationMode=PUSH, updateMessage=ProjectUpdated(editCount=857, uuid=e6b7a67d-a414-481b-3bb4-8362b507de6a)  
> INFO [FPMIApp-AWT-EventQueue-2] Starting Up...
> 
> From initialization function:  
> Initialization has started in background thread.
> 
> From confirmWindowOpen function:  
> Opening Monitoring\_Splash  
> INFO [UpdateProjectPane-ProjectUpdater] Downloading "[http://172.28.33.236:80/main/system/project/C/P/856/e6b7a67d-a414-481b-3bb4-8362b507de6a/OEE\_Andon\_Debug](http://172.28.33.236:80/main/system/project/C/P/856/e6b7a67d-a414-481b-3bb4-8362b507de6a/OEE_Andon_Debug)"...  
> INFO [UpdateProjectPane-ProjectUpdater] Connect successful.  
> INFO [UpdateProjectPane-ProjectUpdater] Starting download of 710016 bytes  
> INFO [UpdateProjectPane-ProjectUpdater] Download successful  
> Writing project to cache file C:\Users\lisawas.ignition\cache\gw172.28.33.236\_80\_8043\_main\C1\CPOEE\_Andon\_Debug.proj
> 
> From initialization function:  
> Initialization has started in background thread.
> 
> From confirmWindowOpen function:  
> Opening Monitoring\_Splash  
> Window opened successfully after 4095 cycles.  
> Window opened successfully after 0 cycles.
> 
> From updateSplashText function:  
> New line added: Login: lisawas
> 
> From updateSplashText function:  
> New line added: Building ID: 28
> 
> From updateSplashText function:  
> New line added: IDs of Monitored Areas: 2, 3, 4, 1
> 
> From updateSplashText function:  
> New line added: Sound configuration: 3  
> Client tag change detected:  
> Tag: [Client]ANDON/BuildingID  
> Value: 28  
> Quality: Good  
> Time: Tue Aug 06 11:33:06 MST 2013
> 
> Client tag change detected:  
> Tag: [Client]ANDON/AreaNameSqlList  
> Value: 2, 3, 4, 1  
> Quality: Good  
> Time: Tue Aug 06 11:33:06 MST 2013
> 
> From updateSplashText function:  
> New line added: Login: lisawas
> 
> From updateSplashText function:  
> New line added: Building ID: 28
> 
> From updateSplashText function:  
> New line added: IDs of Monitored Areas: 2, 3, 4, 1
> 
> From updateSplashText function:  
> New line added: Sound configuration: 3  
> Client tag change detected:  
> Tag: [Client]ANDON/BuildingID  
> Value: 28  
> Quality: Good  
> Time: Tue Aug 06 11:33:06 MST 2013
> 
> Client tag change detected:  
> Tag: [Client]ANDON/AreaNameSqlList  
> Value: 2, 3, 4, 1  
> Quality: Good  
> Time: Tue Aug 06 11:33:06 MST 2013
> 
> Station Data has 59 row(s), 6 column(s).  
> Station Data has 59 row(s), 6 column(s).  
> Rotator Data has 59 row(s), 4 column(s).  
> Rotator Data has 59 row(s), 4 column(s).

---

<div class="post-metadata">

**Author:** ![Robert.McKenzie](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/robert.mckenzie/32/4134_2.png) [@Robert.McKenzie](https://forum.inductiveautomation.com/u/Robert.McKenzie)\
**Post date:** [December 23, 2013, 10:12pm UTC](https://forum.inductiveautomation.com/t/determining-programmatically-when-window-is-finished-opening/6992/3 "2013-12-23T22:12:57Z")

</div>

There is a visionWindowOpened event on the windows now that you can use that won’t be fired until after the window is finished opening (but before the bindings are evaluated).
