Please ensure Javascript is enabled for purposes of website accessibility
Powered by Zoomin Software. For more details please contactZoomin

AVEVA™ XR Studio

usetemplate

  • Last UpdatedFeb 19, 2025
  • 2 minute read

Use the usetempate command to create an instance of a template defined inside the script with a Deftemplate node. Templates reduce the need to write repetitive text many times. Using templates you can create complex behaviors just with a node.

To use a template, you need to indicate the unique name of the template to instantiate and provide all the values for its defined placeholders. The values set for the placeholders are copied inside placeholders as string so you can provide:

  • Constants of every field type ("0 1 1", true, "10.45").

Field values (node fields or constants) with the field value referencing mode that uses @node.field@ syntax.

Note: You must provide all the placeholder values defining them as attributes of the node, just like they are fields of the usetemplate node.

Platform support

This element is fully supported on XR-Windows, XR-Portable Windows, XR-Portable iOS, XR-Portable Android, and XR-P WASM platforms.

XR-WIN

XR-P-WIN

XR-P-IOS

XR-P-AND

XR-P-WASM

Full support

Full support

Full support

Full support

Full support

Full support

Full support

Full support

Full support

Full support

Code example

This is a code example for the usetemplate element.

<deftemplate name="tbutton"> <button name="c_%id%" show="true" position="%position%" size="40 40" >

<rect>

<rect show="true" image="ICO_DPI_Avatar.png" order="5" position="0 5" size="40 30"/>

<text show="true" text="%text%" font="Baveuse,true,40" format="Left Up" order="2" position="60 0" size="400 50" color="1 1 1 1"/>

</rect>

<rect>

<rect image="ICO_DPI_Avatar_sel.png" order="5" show="true" position="0 5" size="40 30" />

<text show="true" text="%text%" font="Baveuse,true,40" format="Left Up" order="2" position="60 0" size="400 50" color="0 0.9 0 1"/>

</rect>

</button>

<rect name="c_%id%s" show="true" image="ICO_SelectorAvatar.png" order="8" position="%position2%" size="450 54" />

</deftemplate>

<usetemplate name="tbutton" id="0" position="20 20" position2="10 14" text="@lang:dpi_0@" />

See Also

Using a template

Position

The usetemplate element must be inside a context node, such as Context or Global.

Fields

These are the fields for usetemplate command.

Fields

Type

Use

Default value

Description

name

sstring

Mandatory

Not set

The name of the template created with deftemplate that is going to be instantiated.

In This Topic
TitleResults for “How to create a CRG?”Also Available in