# Move popup windows (center, upper,lower right,left position)

**URL:** <https://forum.inductiveautomation.com/t/move-popup-windows-center-upper-lower-right-left-position/7941>\
**Category:** Ignition\
**Created:** [February 3, 2014, 9:01am UTC](https://forum.inductiveautomation.com/t/move-popup-windows-center-upper-lower-right-left-position/7941 "2014-02-03T09:01:34Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![mazeyrat](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/mazeyrat/32/10955_2.png) [@mazeyrat](https://forum.inductiveautomation.com/u/mazeyrat)\
**Post date:** [February 3, 2014, 9:01am UTC](https://forum.inductiveautomation.com/t/move-popup-windows-center-upper-lower-right-left-position/7941/1 "2014-02-03T09:01:34Z")

</div>

I need to move a popup windows with the following command :

- centerWindow = \> system.nav.centerWindow
- move to the upper right position =\> ?
- move to the upper left position =\> ?
- move to the lower right position =\> ?
- move to the lower left position =\> ?

system.nav.xxxxx script function would be cool to do that, or perhpas there is a way with swing…  
 ![:scratch:](https://us1.discourse-cdn.com/inductiveautomation/original/1X/76d1620bec252bfac07050c889ff5a91dc8a9c25.gif ":scratch:")

---

<div class="post-metadata">

**Author:** ![nmudge](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/nmudge/32/3394_2.png) [@nmudge](https://forum.inductiveautomation.com/u/nmudge)\
**Post date:** [February 3, 2014, 4:16pm UTC](https://forum.inductiveautomation.com/t/move-popup-windows-center-upper-lower-right-left-position/7941/2 "2014-02-03T16:16:50Z")

</div>

You can set the size and location of windows with:  
window.setSize(250,600)  
window.setLocation(0,0)

Best,  
Nick Mudge

---

<div class="post-metadata">

**Author:** ![adamaustin](https://avatars.discourse-cdn.com/v4/letter/a/5f8ce5/32.png) [@adamaustin](https://forum.inductiveautomation.com/u/adamaustin)\
**Post date:** [February 3, 2014, 7:42pm UTC](https://forum.inductiveautomation.com/t/move-popup-windows-center-upper-lower-right-left-position/7941/3 "2014-02-03T19:42:18Z")

</div>

Yep, here’s some code to use:

(NOTE: doesn’t work so well with docked windows. Let me know if you need a more elegant solution.)

```auto

sWindowToOpen = "NewWindow"

iPosition = iPos
#0 is CENTER
#1 is NORTHWEST
#2 is NORTHEAST
#3 is SOUTHWEST
#4 is SOUTHEAST

win = system.gui.getParentWindow(event)
iX = win.getX()
iY = win.getY()
iW = win.getWidth()
iH = win.getHeight()

newWindow = system.nav.openWindow(sWindowToOpen)
iNewX = newWindow.getX()
iNewY = newWindow.getY()
iNewW = newWindow.getWidth()
iNewH = newWindow.getHeight()

if iPosition == 0:
	#CENTER
	system.nav.centerWindow(newWindow)
else:
	if iPosition == 1:
		#NORTHWEST
		newX = iX
		newY = iY
	elif iPosition == 2:
		#NORTHEAST
		newX = iW - iNewW
		newY = iY
	elif iPosition == 3:
		#SOUTHWEST
		newX = iX
		newY = iH - iNewH
	elif iPosition == 4:
		#SOUTHEAST
		newX = iW - iNewW
		newY = iH - iNewH
	else:
		newX = iNewX
		newY = iNewY
	newWindow.setLocation(newX,newY)
```

---

<div class="post-metadata">

**Author:** ![mazeyrat](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/mazeyrat/32/10955_2.png) [@mazeyrat](https://forum.inductiveautomation.com/u/mazeyrat)\
**Post date:** [February 4, 2014, 2:38pm UTC](https://forum.inductiveautomation.com/t/move-popup-windows-center-upper-lower-right-left-position/7941/4 "2014-02-04T14:38:15Z")

</div>

Thanks for the boilerplate code ![:thumb_left:](https://us1.discourse-cdn.com/inductiveautomation/original/1X/e26afb081ddde6df016df6ee49159cf56aaca688.gif ":thumb\_left:")
