变量触发wincc动态显示
林慧玲
发布于2014-03-24 17:51
2
0
标签:
想做一个这样的功能:当某一个变量为true时,动态显示一个物体的前进,现在物体的前进已经做到了,通过vbs
functionleft_trigger(byvalitem)
ifitem.left>110then
item.left=item.left-10
else
item.left=110
endif
endfunction
用一个按钮触发:
subonclick(byvalitem)
dimmytag
mytag=hmiruntime.tags("motor_set_1").read
ifmytag<20then
dimellipse
setellipse=screenitems("ellipse2")
ellipse.activatedynamic"left","cycletime125ms"
dimellipsee
setellipsee=screenitems("ellipse1")
ellipsee.activatedynamic"top","cycletime125ms"
endif
endsub
可是无论怎么着也试不出来,如果通过变量的变化来触发这个动作,wincc的初学者,
佳答案
脚本有问题。测试一下如果item.left=110,if条件不满足,则不会减,只会执行else后面的item.left=110。
说的变量为true,是哪个变量?
vbs:
dimtag1
tag1=hmiruntime.tags("tag").read'变量为true
iftag1then
item.left=item.left-10
endif
ifitem.left<=0then
item.left=110
endif
以上脚本周期执行,才会实现如果tag为true则物体从110的位置移动到0的位置,然后再回到110的位置从新向0的位置移动。