Skip to main content
Version: 7.9

Advanced Template Features

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

Changing Template Path

Inductive University

Changing Template Path

Watch the video

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.

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

Inductive University

Template Repeater

Watch the video

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.

info

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