Viz Trio User Guide
Version 3.2 | Published June 29, 2021 ©
Viz Template Wizard Scripting
In Viz Trio, a Viz Template Wizard template can be used to 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.
An example of a text box and a button being used to generate a label at run-time follows below:
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
Setting and Getting Component Values
Viz Trio has support for the SetUnicodeValue and GetUnicodeValue functions in Viz Template Wizard.
An example of a text box being used to get and set a value in another text box without using TrioCmd follows below:
Sub TWUniEdit1Change(Sender) Text = GetUnicodeValue(TWUniEdit1) SetUnicodeValue TWUniEdit2, Text End Sub
Setting and Getting Show Values
Using Viz Template Wizard to create standard templates for a show is quite useful as it enables the show to execute default commands for an entire show. It's therefore possible to set and get show values; however, there are some subtle differences in how to achieve both.
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 return (get) values a command must be properly triggered by another event because all Viz Trio commands are queued; hence, the return value will be QUEUED. When a top-level command is executed (from the GUI or a macro) it is 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 about, the second command vtwtemplate:run_vtw_script will be triggered within GetDescription and return the description value.