各位大神好,我有个按钮里有脚本,现在不想要按钮,想降按钮的脚本放在全局脚本里,直接复制过去在调试工具里报错,该怎么改?
启动按钮脚本如下:
Sub OnClick(ByVal Item)
Dim poly
Set poly=ScreenItems("polyline01")
poly.Visible=True
Select Case HMIRuntime.Tags("WaterFlowSpeed").Read
Case 0
poly.ActivateDynamic "ActualPointLeft","CycleTime500ms"
Case 1
poly.ActivateDynamic "ActualPointLeft","CycleTime250ms"
Case 2
poly.ActivateDynamic "ActualPointLeft","CycleTime125ms"
End Select
HMIRuntime.Tags("WaterFlowStart").Write True
End Sub
最佳答案
应为你的按钮脚本是在当前页面的,所以可以直接这样用,用全局脚本你需要告诉脚本你的polyline01在哪个画面上,
Dim poly
Set poly=hmiruntime.Screen("画面")ScreenItems("polyline01")//画面是polyline01所在的画面名称
poly.Visible=True
Select Case HMIRuntime.Tags("WaterFlowSpeed").Read
Case 0
poly.ActivateDynamic "ActualPointLeft","CycleTime500ms"
Case 1
poly.ActivateDynamic "ActualPointLeft","CycleTime250ms"
Case 2
poly.ActivateDynamic "ActualPointLeft","CycleTime125ms"
End Select
HMIRuntime.Tags("WaterFlowStart").Write True
提问者对于答案的评价:
谢谢
原创文章,作者:more0621,如若转载,请注明出处:https://www.zhaoplc.com/plc317327.html