# system.gui.moveComponent strangenesses

**URL:** <https://forum.inductiveautomation.com/t/system-gui-movecomponent-strangenesses/5015>\
**Category:** Ignition\
**Created:** [August 16, 2012, 5:45am UTC](https://forum.inductiveautomation.com/t/system-gui-movecomponent-strangenesses/5015 "2012-08-16T05:45:08Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![unkier](https://avatars.discourse-cdn.com/v4/letter/u/d6d6ee/32.png) [@unkier](https://forum.inductiveautomation.com/u/unkier)\
**Post date:** [August 16, 2012, 5:45am UTC](https://forum.inductiveautomation.com/t/system-gui-movecomponent-strangenesses/5015/1 "2012-08-16T05:45:08Z")

</div>

hello.  
currently, we are developing a prototype of our system, and have faced with strangenesses. preview mode working as it should. but after publishing, project behavior totally different. our application simply moves one element to the coords of another element using system.gui.moveComponent. it is not tied to absolute values. here is a sample:

`rail_part = root_container.getComponent(name)
system.gui.moveComponent(event.source, rail_part.x, rail_part.y)`

in preview mode everything is ok, but after publish, element starts to appears in strange places.

what we are doing wrong?

---

<div class="post-metadata">

**Author:** ![Michael.Stofan](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/michael.stofan/32/3342_2.png) [@Michael.Stofan](https://forum.inductiveautomation.com/u/Michael.Stofan)\
**Post date:** [August 16, 2012, 6:56pm UTC](https://forum.inductiveautomation.com/t/system-gui-movecomponent-strangenesses/5015/2 "2012-08-16T18:56:04Z")

</div>

Because of the way the layout system works, you have two options to make this work. The simplest way is to set the layout mode of everything that needs animating to ‘anchored – top/left’. This will ensure that the coordinates you are passing system.gui.moveComponent() (as in component.x and component.y) are the coordinates it wants.

If you need the layout to be relative, you’ll have to pass coordinates to system.gui.moveComponent() in terms of where the destination exists in the designer and everything will get extrapolated out when the client runs. This means using static values for your script. Hope this was helpful, cheers.

---

<div class="post-metadata">

**Author:** ![unkier](https://avatars.discourse-cdn.com/v4/letter/u/d6d6ee/32.png) [@unkier](https://forum.inductiveautomation.com/u/unkier)\
**Post date:** [August 17, 2012, 3:15pm UTC](https://forum.inductiveautomation.com/t/system-gui-movecomponent-strangenesses/5015/3 "2012-08-17T15:15:31Z")

</div>

Thank you !
