Open Popup on another popup at cursor location

I would like to open a popup on an existing popup at the cursors position on an event (mouse release).

using event.x and event.y gives you the cursor position of the events source component (button), so a button that is 30 x 10 clicked in the middle gives you 15 and 5…

Setting the location of the new popup using those coordinates then shows the window based on the projects full window, so you get the popup in the top left corner.

I was hoping that the event location would be based on the entire screen but seems no to be.

Any ideas?

cheers

Tim…

So in order to accomplish this, you will need to know the x and y location of the button in the window and the x and y location of the window in the client. You will need to use getX() and getY() on both the component and the window. The script will look something like this:

[code]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 = system.nav.openWindow(“Popups/Popup”)

window.setLocation(mouseX+compX+windowX,mouseY+compY+windowY)[/code]

3 Likes

Legend. :prayer:

Will give it a go

Cheers

Worked like a dream.

Thanks again.