Windows Opening and Closing Scripting

Hi Everyone,

I’m trying to achieve the following :

When I Open a page, I’d like to store somewhere the information of a lock and the name of the client using the resource.

I try to resume :

I wrote a UDT containing :

isLocked -> Bool

LockedBy -> String

Then I wrote a script on the Windows Opening section of the VisionWindow paragraph.

The script set the Bool and write the host name in the udt, which is been declared on the gateway scope.

Now the issue, when I close the window I have another script resetting the two fields, but unfortunately it does not behave as I’d like to.

It seems that when I close a window by opening another one, the script of the new opened run before the closing one.

So basically the new windows set the new Lock, and the old one reset everything.

I tried to approach different ways, but if you could give me a hint to understand how to make this run, it will solve me lots of troubles due the architecture asked by the costumer.

Thanks

How are you opening the new windows? If you are using the Navigation tab in an actionPerformed event handler then the default behavior is opening the new window before closing the original window so you will want to use a script instead.

1 Like

Thanks ethomason,

I actually used a container to fire the swap, in fact when i looked into it, i found out in the script section the following :

window = system.nav.openWindow(‘myWindow’)
system.nav.centerWindow(window)
system.nav.closeParentWindow(event)

That explain a lot of the previous behavior.

I guess if i just pull the closeParentWindow before the openWindow I will solve all my troubles.

Thanks a lot, it would take long time for me to go check in the script section to found out that the default behavior of a swap page, is open a new one than close the old one.