Skip to end of metadata
Go to start of metadata

Some of the advanced template features in the Designer are: changing Template Path using Template Repeater and Cloud Templates.

 

Changing Template Path

An instance of a template on a window has a property called Template Path. You can change this property on a window dynamically, and it can be bound to anything that produces a valid template path.

For example, if there are two tank templates in a folder called Tanks, one template is called Tank A and the other is called Tank B. Each tank has a different look, but they have the same Custom properties. Their respective template paths are Tanks/Tank A and Tanks/Tank B. The template rendered on a window can swap between Tank A and Tank B by binding the template's property to any string reference that says Tanks/Tank A or Tanks/Tank B.


IULocgo


Changing Template Path

 

Accessing Components Inside a Template Instance

When working with a Template Instance, the components inside that instance or normally hidden, and otherwise inaccessible. However, you can access these components via scripting. It helps to think of Template Instances as multi-layer containers. In most cases, users interact with only the Outer Layer, which contains the Template parameters, and the other default Template Instance properties. A Python script can access the Inner Layer, which then provides access to the components within. 

A script can traverse to the Inner Layer from the Outer Layer with a getComponent call. 

Pseudocode - Acessing the Inner Layer
myTemplate = event.source.parent.getComponent('MyTemplate')

# The '0' in the first getComponent call effectively refers to an index value of a component, which happens to be the Inner Layer. 
myTemplate.getComponent(0)

From the Inner Layer, a script can then call  getComponent again to access any components within. Assuming a Template with a Label component named "Label", we could access the Text property with the following:

Pseudocode - Accessing a Component From the Outer Layer
myTemplate = event.source.parent.getComponent('MyTemplate')

print myTemplate.getComponent(0).getComponent('Label').text


Template Repeater

The Template Repeater component lets you easily create multiple instances of a master template for display on the HMI. Each instance shown in the Template Repeater has the same look, feel, and functionality of the master template. The instances can be arranged vertically, horizontally, or in a "flow" layout, which can either be top-to-bottom or left-to-right. If there are too many instances to fit, a scrollbar is added to the display.

Additional information on the Template Repeater can be found on the Template Repeater Component page in the appendix.


IULocgo


Template Repeater

 

This feature is new in Ignition version 7.9.13
Click here to check out the other new features

Cloud Templates

Cloud Templates have been moved to the new Ignition Exchange, a free online repository of templates hosted by Inductive Automation. 

 

 


 

  • No labels