Hello, how can I access a custom method of a template from a other window?
I have tried doing this:
window = system.gui.getWindow('example')
template = window.getRootContainer().getComponent('templateName')
#addPen= custom methode
template.getComponent(0).parent.addPen()
thanks you
Do you mean a custom property?
To get the value of custom property you can do:
windowPath = "Main Window"
templateName = "myTemplate"
parameterName = 'myParameter'
window = system.gui.getWindow(windowPath)
template = window.getRootContainer().getComponent(templateName)
parameterValue = template.getParameterValues()[parameterName]
Make sure that the window where your template is located to stay open, otherwise you’ll get an error.
Hello @jespinmartin1 i mean a custom function, no a custom property
That sound confusing, What do you mean by “to access”? Do you want to execute the custom method by some listener or extract the code as string?
To trigger the method you can add a property to the template as a trigger like:
each time you wish to execute the method pass a true value
1 Like
Thank you. I have tried doing it this way and it works perfectly.