Vizrt resize TextFields


structure onoffcontainer
dMSDifference as double
sContainerName as string
end structure
dim iLineNumber = (integer) 8
dim sLinePrefix = (string) "ONOFF_LINE_"
dim sLinesDomain = (string) "ONOFF_DATA"
dim sNameTextName = (string) "txt_name"

dim bMultipages = (boolean) true
dim sPagePrefix = (string) "PAGE_"

' max site differences when elements are "ON"
dim dMSBase = (double) 900

' setter tous les ONOFF qui agissent sur le maxsize
dim oIrm as onoffcontainer
oIrm.dMSDifference = -130
oIrm.sContainerName = "ONOFF_IRM"

dim oNoc as onoffcontainer
oNoc.dMSDifference = -70
oNoc.sContainerName = "ONOFF_NOC"

dim arrOnOff as array[onoffcontainer]
arrOnOff.push(oIrm)
arrOnOff.push(oNoc)

sub OnInitParameters()
RegisterPushButton("checkonoff","Check on/offs", 1)
end sub

sub OnExecAction(buttonId As Integer)
if bMultipages then
TreatMultipagesLines()
else
TreatLines()
end if
end sub

sub TreatLines()
dim i = (integer) 0
for i=1 to iLineNumber
dim cBaseContainer = (container) scene.findcontainer(sLinePrefix&i).findsubcontainer(sLinesDomain)
dim cTextContainer = (container) cBaseContainer.findsubcontainer(sNameTextName)
dim dMSBaseTemp = (double) dMSBase

For Each j In arrOnOff
if cBaseContainer.findsubcontainer(j.sContainerName).active == true then
dMSBaseTemp = dMSBaseTemp+j.dMSDifference
end if

Next
cTextContainer.GetFunctionPluginInstance("Maxsize").SetParameterDouble("WIDTH_X",dMSBaseTemp)
next

end sub
sub TreatMultipagesLines()
dim i = (integer) 0
for p=1 to 2
for i=1 to iLineNumber
dim cBaseContainer = (container) scene.findcontainer(sPagePrefix&p).findsubcontainer(sLinePrefix&i).findsubcontainer(sLinesDomain)
dim cTextContainer = (container) cBaseContainer.findsubcontainer(sNameTextName)
dim dMSBaseTemp = (double) dMSBase
dim iVal = (string) p
System.SendCommand(iVal)
For Each j In arrOnOff

if cBaseContainer.findsubcontainer(j.sContainerName).active == true then
dMSBaseTemp = dMSBaseTemp+j.dMSDifference
end if

Next
cTextContainer.GetFunctionPluginInstance("Maxsize").SetParameterDouble("WIDTH_X",dMSBaseTemp)
next
next
end sub