How to load an XUI dialog on startup?

Answered by: Tung Fu (PTC) Last Updated: 2006-08-04

=Question by Keith Berard=

I was wondering if there is any way to have a XUI dialog load on Epic startup?

I have tried several different ways, from ACL, to js, to a class file, and all seem to fail on the show method. I have tried putting the file(s) in the custom/init dir, as well as putting them in the custom/scripts dir, and calling them from ACL with no luck.

This always works fine if I execute it from the command line post-startup, and works fine if I put the script/class in the custom/editinit dir. Is there something that I'm missing? Is this even possible?

I am using Epic 5.1M.

=Tung Fu answers=

At the time the ApplicationLoad listener is called, the main edit window is created but not displayed, so createDialogFromFile tries to use the desktop window as its parent. This doesn't work for dockable dialogs. The method should work if you specify the correct parent window. We will modify Epic so that you won't need to specify the parent for this case in the future.

The dockable dialog is very different than other dialogs so that you cannot change a normal dialog to a dockable dialog. Once a dockable dialog is created, you can dock it by manipulating the "dock" attribute of the window element or calling the dockTo method of the AOM Window class.

function handleEvent(e) { var frame = Application.activeDocument.defaultView.window; Application.createDialogFromFile('c:/mydir/mydialog.xml', null, frame).show; } var o = { handleEvent: handleEvent }; var listener = Packages.org.w3c.dom.events.EventListener(o); Application.addEventListener("ApplicationLoad", listener, false);