Cursor xy Location on a template

Hi Guys,

Slightly new tweak to an older solved issue >> http://www.inductiveautomation.com/forum/viewtopic.php?f=70&t=10922

I have a Popup which contains multiple instances of the same template. The template has a button to call another popup at the cursors location.

Using the code below I can get it working for only 1 instance of the template.

mouseX = event.x
mouseY = event.y
compX = event.source.getX()
compY = event.source.getY()
parWindow = system.gui.getParentWindow(event)
windowX = parWindow.getX()
windowY = parWindow.getY()

window = system.nav.openWindow("Popups/Popup")

window.setLocation(mouseX+compX+windowX,mouseY+compY+windowY)

Is there a way to some how use the unique name of the template instance that the event is occurring in?

event.source.parent.name

gives me the template name but not the instance name…

Cheers for any pointers

Tim…

How about using a custom property on your template? You would have to manually enter a value for this property for each instance in the designer but it would allow you to identify which instance fired the event.

Haha, Cheers

Its always the simple things you totally miss…

Works a treat.

Many thanks. :thumb_left: