# Rectangle Tool or Symbol reshape problem

**URL:** <https://forum.inductiveautomation.com/t/rectangle-tool-or-symbol-reshape-problem/5027>\
**Category:** Ignition\
**Created:** [August 17, 2012, 7:48am UTC](https://forum.inductiveautomation.com/t/rectangle-tool-or-symbol-reshape-problem/5027 "2012-08-17T07:48:44Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![skallepalli](https://avatars.discourse-cdn.com/v4/letter/s/54ee81/32.png) [@skallepalli](https://forum.inductiveautomation.com/u/skallepalli)\
**Post date:** [August 17, 2012, 7:48am UTC](https://forum.inductiveautomation.com/t/rectangle-tool-or-symbol-reshape-problem/5027/1 "2012-08-17T07:48:44Z")

</div>

Dear Inductive Team,

We had a requirement where we need to change the Position, Size of a Rectangle Tool / Symbol (from Symbol Factory) based on User data entry. To start with: We placed one tool / Symbol and one Numeric text Field for new width entry; change width by keeping the tool’s / Symbol’s X, Y positions and height as it has initially. When we used following code, it is taking 0,0 as X,Y positions and complete container height as its height.

[code]# Get required variables.  
vShape = event.source.parent.getComponent(‘Rectangle’)  
vX = vShape.x  
vY = vShape.y  
vHeight = vShape.height

# Get new width from Numeric Text Field.

vWidth = event.source.parent.getComponent(‘Numeric Text Field’).intValue

# Check whether entered width is greater than ‘0’ or not.

if vWidth \> 0:   
# Reshape component to new Width.  
system.gui.reshapeComponent(vShape, vX, vY, vWidth, vHeight)  
else:  
system.gui.errorBox(‘Width should be greater than 0.’, ‘Invalid width’)[/code]  
Another observation is, When we see X, Y values for the tool / Symbol in the Designer it shows one value; In event handler it is showing different value (tested through error box).

Waiting for your valuable suggestions.

---

<div class="post-metadata">

**Author:** ![Travis.Cox](https://avatars.discourse-cdn.com/v4/letter/t/b9bd4f/32.png) [@Travis.Cox](https://forum.inductiveautomation.com/u/Travis.Cox)\
**Post date:** [August 17, 2012, 3:09pm UTC](https://forum.inductiveautomation.com/t/rectangle-tool-or-symbol-reshape-problem/5027/2 "2012-08-17T15:09:07Z")

</div>

The problem is that the component’s x and y may change in the runtime due to the component’s layout. So there is the x and y that you saved in the designer and a relative x and y that you get in the runtime. The x and y you see on the rectangle is the relative x and y. The system.gui.reshapeComponent expects you to work from the designer’s x and y. It will perform the translation necessary to convert it to the relative x and y due to the layout.

So, you should hard code the x and y initially rather than getting it from the component. You can also not use the system function and just set the components relX, relY, relHeight, relWidth directly.

---

<div class="post-metadata">

**Author:** ![skallepalli](https://avatars.discourse-cdn.com/v4/letter/s/54ee81/32.png) [@skallepalli](https://forum.inductiveautomation.com/u/skallepalli)\
**Post date:** [August 20, 2012, 10:22am UTC](https://forum.inductiveautomation.com/t/rectangle-tool-or-symbol-reshape-problem/5027/3 "2012-08-20T10:22:16Z")

</div>

Thank you Travis.

We got your point. We will try with different approach for achieving our requirement.
