Drag popup from click initiated anywhere in the window

This should work.

Add the following custom properties on the popup.
mX (Integer)
mY (Integer)

On the mousePressed event of the popup, enter the following:

event.source.mX = event.x event.source.mY = event.y

On the mouseDragged event of the popup, enter the following:

[code]
window = system.gui.getParentWindow(event)
mouseX = event.x
mouseY = event.y
windowX = window.getX()
windowY = window.getY()

window.setLocation(mouseX+windowX-event.source.mX,mouseY+windowY-event.source.mY)[/code]

13 Likes