Viz Trio User Guide

Version 4.1 | Published September 25, 2023 ©

Viz Template Wizard Scripting

A Viz Template Wizard template can be used to further extend a show’s functionality.

This section covers the following topics:

Dynamically Adding Components

Viz Trio supports the CreateVTWComponent function in Viz Template Wizard for dynamically adding components at run-time.

The following is an example where a text box and a button are used to generate a label at run-time:

curY = AddButton.Top + AddButton.Height + 5 Sub AddButtonClick(Sender) lbl = CreateVTWComponent("TTWUniLabel", Sender.Parent) lbl.Parent = Sender.Parent lbl.Left = Sender.Left lbl.Top = curY curY = curY + lbl.Height + 2 SetUnicodeValue lbl, GetUnicodeValue(SampleEdit)End Sub

Set and Get Component Values

Viz Trio supports the SetUnicodeValue and GetUnicodeValue functions in Viz Template Wizard.

The following is an example of a text box being used to get and set a value in another text box without using TrioCmd:

Sub TWUniEdit1Change(Sender) Text = GetUnicodeValue(TWUniEdit1) SetUnicodeValue TWUniEdit2, Text End Sub

Set and Get Show Values

Using Viz Template Wizard to create standard templates for a show is useful as it enables you to execute default commands for an entire show. It's therefore possible to set and get show values; however, there are some subtle differences between the two.

For example, when issuing a command such as TrioCmd("page:read 1000") within a Viz Template Wizard template, the page numbered 1000 will be read and previewed.

However, in order to get (return) values, a command must be properly triggered by another event since all Viz Trio commands are queued. The return value will therefore be QUEUED. When a top-level command is executed (from the interface or a macro) it's added to an internal queue and executed after other queued commands are finished.

In order to get return values, the code using TrioCmd() must be issued by another top-level command. In a VTW template this is achieved by adding Viz Trio commands to events:

Function OnMyButtonClick(Sender) TrioCmd("page:read 1000") TrioCmd("vtwtemplate:run_vtw_script GetDescription") TrioCmd("page:read 1100") ... End Function Function GetDescription() returnvalue = TrioCmd("page:getdescription") msgbox returnvalue End Function

In the example above, the second command vtwtemplate:run_vtw_script will be triggered within GetDescription and return the description value.