# Dragging objects in the window

**URL:** <https://forum.inductiveautomation.com/t/dragging-objects-in-the-window/7624>\
**Category:** Ignition\
**Created:** [November 25, 2013, 11:25am UTC](https://forum.inductiveautomation.com/t/dragging-objects-in-the-window/7624 "2013-11-25T11:25:21Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![marioquark](https://avatars.discourse-cdn.com/v4/letter/m/22d042/32.png) [@marioquark](https://forum.inductiveautomation.com/u/marioquark)\
**Post date:** [November 25, 2013, 11:25am UTC](https://forum.inductiveautomation.com/t/dragging-objects-in-the-window/7624/1 "2013-11-25T11:25:21Z")

</div>

Hi,  
i’ve read about the ways to move objects around.  
i have to move a group, only clicking on the “move icon” inside it.  
i’m working with the moveComponent().  
the code on the icon’s mouseDragged event is:

```auto
system.gui.moveComponent(event.source.parent, event.x, event.y)
```

what happens is the group moves (even blinking while moved) in the middle position between the original position and the mouse position, that is not on the current mouse position.  
note that this behaviour is not present if the script is put on a simple object, out of groups.  
what can i do?  
thank you,  
mario

---

<div class="post-metadata">

**Author:** ![dave.fogle](https://avatars.discourse-cdn.com/v4/letter/d/43a26b/32.png) [@dave.fogle](https://forum.inductiveautomation.com/u/dave.fogle)\
**Post date:** [November 26, 2013, 12:02am UTC](https://forum.inductiveautomation.com/t/dragging-objects-in-the-window/7624/2 "2013-11-26T00:02:01Z")

</div>

You're going to have to add a couple of things. First your container is going to need to be anchored top-left. Second you're going to change your script to look like the following:

```python
point = system.gui.convertPointToScreen(event.x, event.y, event)
system.gui.moveComponent(event.source.parent, point[0], point[1])
```

You'll notice that the group will jump down and to the left a little bit when you start to move it. That's because it's applying the move to the top left corner of the container. If you want it to not jump like that you're going to have to keep track of the difference between where you actually clicked and where the top left corner of the container is and factor that in to your coordinates.

Hope this helps.
