# Drag popup from click initiated anywhere in the window

**URL:** <https://forum.inductiveautomation.com/t/drag-popup-from-click-initiated-anywhere-in-the-window/7401>\
**Category:** Ignition\
**Created:** [October 11, 2013, 9:02pm UTC](https://forum.inductiveautomation.com/t/drag-popup-from-click-initiated-anywhere-in-the-window/7401 "2013-10-11T21:02:12Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![jaepark](https://avatars.discourse-cdn.com/v4/letter/j/c6cbf5/32.png) [@jaepark](https://forum.inductiveautomation.com/u/jaepark)\
**Post date:** [October 14, 2013, 5:15pm UTC](https://forum.inductiveautomation.com/t/drag-popup-from-click-initiated-anywhere-in-the-window/7401/2 "2013-10-14T17:15:14Z")

</div>

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]

---

_[View the full topic](https://forum.inductiveautomation.com/t/drag-popup-from-click-initiated-anywhere-in-the-window/7401)._
