Client Startup Script

I am attempting to open and center a popup window on client startup.

system.nav.openWindow("window1")
system.nav.centerWindow("window1")

My window does not center. It does move somewhat from where it would be if I do not attempt to center it with the client startup script. This occurs when the client is set to “Web Start” and also when set to “Web Start Maximized.”

Any ideas?

Well, the centerWindow function will center the popup over the currently maximized window. If you don’t have a maximized window already open it may not work correctly. Try the following code instead:[code]def center(window):
import system
try:
parent = window.parent
if parent != None:
window.setLocation(parent.width/2 - window.width/2, parent.height/2 - window.height/2)
except ValueError:
pass

window = system.nav.openWindow(“Window”)
center(window)[/code]You can make the center function a global script module function that you can use everywhere.