Multiple Window Instances

Hi, I’m trying to figure out a way to open multiple instances of a single popup window but leave one specific window open when system.nav.closeWindow(‘WindowLocation’) closes a window.

Basically what I’m trying to accomplish (and I’m pretty close) is when I hover over a component I want a popup window to open and hover next to my mouse and when my mouse leaves the component i want it to disappear ( I have this first part working). Next, if I click on the component it will open another instance of the popup window that I want to stay opened (Also working). But here’s where I’m running into issues. After I have the window instance opened and hover back over the component the popup that I wanted to stay opened disappears when the window opens back up. Here’s what my event handler Component scripting looks like:

mouseExited:

system.nav.closeWindow(‘WindowLocation’)

mouseReleased:

window = system.nav.openWindowInstance(‘WindowLocation’)
mouseX = event.x
mouseY = event.y
compX = event.source.getX()
compY = event.source.getY()
parWindow = system.gui.getParentWindow(event)
windowX = parWindow.getX()
windowY = parWindow.getY()

window.setLocation(mouseX+compX+windowX,mouseY+compY+windowY+50)

mouseMoved:

window = system.nav.openWindow(‘WindowLocation’)

mouseX = event.x
mouseY = event.y
compX = event.source.getX()
compY = event.source.getY()
parWindow = system.gui.getParentWindow(event)
windowX = parWindow.getX()
windowY = parWindow.getY()

window.setLocation(mouseX+compX+windowX,mouseY+compY+windowY+50)

I’ve been trying to figure this out for a while but no matter what I try to do I can’t figure out a way to be certain that it wont close the wrong window. Thanks for your help!

Could you have two copies of the window? WindowLocation and WindowClicked, then open up WindowClicked on your mouse release event and still open WindowLocation when you hover over and exit. If you’re worried about maintaining two separate windows, you could just leave the windows blank and put a template inside and then anytime you make a change to the template both of the windows would update.

Yeah I think that may just be how I’m going to have to do it. I was trying to avoid creating more windows then necessary if I could but this may be the best option. It would be nice if there was a way to give the window that was opened a name/identifier to call on later for instances like this. Thanks for your help!

[quote=“RyanG”]It would be nice if there was a way to give the window that was opened a name/identifier to call on later for instances like this.[/quote]You could add an ID custom parameter to the window’s root container and supply an ID when opening it. Then look for an existing window in getOpenedWindows() with that name and ID before opening another.
Also, if you use openWindowInstance() for a particular window, use openWindowInstance() for that window everywhere in your project. Otherwise, openWindow() will randomly stomp on the other instances.

Phil, the image that popped into my head just made my day...

:laughing:

Ahhh… interesting. You can access window custom properties with that function? Hmmm… I might have to play with that.

[quote=“Duffanator”]Ahhh… interesting. You can access window custom properties with that function? Hmmm… I might have to play with that.[/quote]The getOpenWindows() function delivers the actual window objects.wlist = system.gui.getOpenedWindows() for w in wlist: if w.rootContainer.ID==myID: print "found it!"