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.