Find component x y in an expression

is there a way to find the X,Y position of a template through a property expression?

something like [quote]{Root Container.mytemplate.getX()}[/quote]

You could put a custom property on your template or component that contains your Y or X value. Then reference that property in your expression.

Or you could use the runScript expression function to call a Python function that gets the X and Y values of a particular component.

thats the problem - the expression im looking to make is for a template property so I can reference that templates position. I have a whole bunch of this template to create instances for and need to know where each one is without putting it in manually. if the property was a script rather than an expression I would just use event.source.parent.getX(). im just not sure how to use an expression to find the X and Y


You can get the X and Y position of a component from within an expression with the following examples

[code]runScript(“system.gui.getWindow(‘Test’).getRootContainer().getComponent(‘Momentary Button’).getX()”, 250)

runScript(“system.gui.getWindow(‘Test’).getRootContainer().getComponent(‘Momentary Button’).getY()”, 250)[/code]

To get a reference to a component for an expression with no event object, replace event.source with self:

runScript("self.getX()", 250)

Within a template, you’ll probably want a parent in there to get the template holder’s position, something like:

runScript("self.parent.getX()", 250)