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

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:

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

Best,
Nick Mudge

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.)


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)
1 Like

Thanks for the boilerplate code :thumb_left: