VIZ SCRIPT


dim sLinePrefix = (string) "LINE_"
dim sLinesDomain = (string) "INFO"
dim sCurrentDomain = (string) "CURRENT_PROGRESS"
dim sLeaderDomain = (string) "LEADER_PROGRESS"
dim sBarDomain = (string) "SCALE_BAR"
dim iLineNumber = (integer) 9
dim sCurrentScore = (string) "txt_score"
dim sLeaderScore = (string) "txt_score_leader"
dim sMaxScore = (string) "txt_value_ref"
sub OnInitParameters()
 RegisterPushButton("setbars","set progressbars length", 1)
end sub
sub OnExecAction(buttonId As Integer)
 SetValues()
end sub
sub SetValues()
 'dim cMaxTextContainer = (string) scene.findcontainer("BODY").findsubcontainer(sMaxValueContainerName)
 'dim dMaxVal = 100
dim i = (integer) 0
 for i=1 to iLineNumber
 dim cBaseContainer = (container) scene.findcontainer(sLinePrefix&i).findsubcontainer(sLinesDomain)
 
 dim cCurrentTextContainer = (container) cBaseContainer.findsubcontainer(sCurrentScore)
 dim cLeaderTextContainer = (container) cBaseContainer.findsubcontainer(sLeaderScore)
 dim cMaxTextContainer = (container) cBaseContainer.findsubcontainer(sMaxScore)
 
 dim dCurrentVal = CDbl(cCurrentTextContainer.geometry.text)
 dim dLeaderVal = CDbl(cLeaderTextContainer.geometry.text)
 dim dMaxVal = CDbl(cMaxTextContainer.geometry.text)
 
 dim dCurrentPercent = (double) (dCurrentVal/dMaxVal)
 dim dLeaderPercent = (double) (dLeaderVal/dMaxVal)
 
 dim dCurrentBar = (container) cBaseContainer.findsubcontainer(sCurrentDomain).findsubcontainer(sBarDomain)
 dim dLeaderBar = (container) cBaseContainer.findsubcontainer(sLeaderDomain).findsubcontainer(sBarDomain)
 
 dCurrentBar.scaling.x = dCurrentPercent
 dLeaderBar.scaling.x = dLeaderPercent
 next
end sub