# Force window to redraw

**URL:** <https://forum.inductiveautomation.com/t/force-window-to-redraw/20018>\
**Category:** Ignition\
**Created:** [October 8, 2018, 4:23am UTC](https://forum.inductiveautomation.com/t/force-window-to-redraw/20018 "2018-10-08T04:23:31Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![ASF](https://avatars.discourse-cdn.com/v4/letter/a/c4cdca/32.png) [@ASF](https://forum.inductiveautomation.com/u/ASF)\
**Post date:** [October 8, 2018, 4:23am UTC](https://forum.inductiveautomation.com/t/force-window-to-redraw/20018/1 "2018-10-08T04:23:31Z")

</div>

I have a popup windows which I open up to look at a particular type of sensor. On the popup are several different numeric entry fields, and a “setup” button. The “setup” button brings up a second popup, on which I check or un-check boxes to determine which fields show up or not on the first popup, based on which characteristics this particular sensor has. So, basically, check a box on popup 2, another field appears on popup 1, using a visibility binding.

If I’m not using a particular item, as well as making it invisible, I also use system.gui.transform to adjust the position of the remaining fields and resize the window, so I don’t have ugly looking gaps everywhere. I run a script when the first popup opens to adjust the positions. This all works just fine, but the only thing is, if I make adjustments on my second popup, the visibility immediately changes, but to make the script re-run to adjust positions and sizes, I have to close both popups and then re-open the first.

Is there a way to  
(a) force the first popup to close and re-open when the visibility of an object on it changes?  
(b) have the second popup force the first popup to run its startup script again?  
© achieve this in some other neat way without copying the entire script into a property change script for every object? (I don’t mind adding a short script to each object to call the main script, but if I ever want to change the main script I don’t want to have to change it in 15 places)

---

<div class="post-metadata">

**Author:** ![pturmel](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pturmel/32/3295_2.png) [@pturmel](https://forum.inductiveautomation.com/u/pturmel)\
**Post date:** [October 8, 2018, 1:17pm UTC](https://forum.inductiveautomation.com/t/force-window-to-redraw/20018/2 "2018-10-08T13:17:29Z")

</div>

Put the main script in a custom method on the root container, calling it from wherever you need.
