Scripting on a template instance


I’m struggling with my first SCADA project and I am in trouble with defining an event script on a template instance. I’ve realized a simple template (a label with some minor graphical elements such as lines, squares, etc.) to use as button for the menu of my main window and after creating an instance of such template, I configure on it a mouse click event to swap to the designated page, but it seems to don’t get the mouse event and thus no swapping occour… :scratch:

I could add the event directly on the label in the template and use a template parameter to pass the correct window name to the instance, but I would avoid this because I’d prefer to define a script on each instance (more handy): how can I do this?

Thank you!


How have you implemented the mouse click event? I created a simple template, placed it on a window, right-clicked it and chose Scripting, then put a simple script under mouseClicked and it works fine.

Hi, I right-clicked on the instance then selected “scripting”. I tryed to use both the “navigation” panel and the script editor (adding a simple print) but it didn’t work (and no errors are prompted…).

After your reply I tryed to create a new template with the same elements and now it seems to work fine… I can’t figure what happened… :blush:

Thank you for your reply,


For future reference:
You might have layered some of the graphical elements (squares) on top of the button. I would select your button and choose ‘Bring to Front’ to make sure it’s z order is on top.