Wincc中如何取经过多层界面调用的对象

在Wincc工程的主界面Main.pdl中有一个Picture Windows1调用的ConMon.pd界面,在ConMon.pdl中又有一个Picture Windows1调用Overview.pdl界面,在Overview中有一个对象Group1。我现在要在工程运行时设置Group1的属性,但是我该怎么获取Group1呢?
我现在做了以下尝试:
1、Set objGroup = HMIRunTime.Screens("Overview").ScreenIteams("Group1"), 该语句只有在单独运行Overview界面时才有效。
2、Set objGroup = HMIRunTime.Screens("Main.MonCon.Overview").ScreenIteams("Group1");
3、Set objGroup = HMIRunTime.Screens("Main.Overview").ScreenIteams("Group1"),
4、Set objGroup = HMIRunTime.Screens("ConMon.Overview").ScreenIteams("Group1"),
以上方式在整个工程运行时均不能正常获取Group1,请指导,谢谢!!

最佳答案

Set objGroup = HMIRunTime.Screens("Main.Picture Windows1.Picture Windows1").ScreenIteams("Group1"),试试这个。

提问者对于答案的评价:
虽然不行,还是谢谢你!

专家置评

通过基本画面引用

可通过 HMIRuntime.Screens 引用具有待修改对象的画面。该画面相对于基本画面的规范通过以下访问代码进行定义:

[<Grundbildname>.]<Bildfenstername>[:<Bildname>]… .<Bildfenstername>[:<Bildname>]

在以下示例中,将创建对“Rectangle1”画面中包含的“Screen2”对象的引用,并将背景颜色设置为红色。

这种情况下,画面“Screen2”位于“Screen1”中。 “Screen1”显示在基本画面“BaseScreen”中。

  
””VBS141

Dim objRectangle

Set objRectangle = HMIRuntime.Screens("BaseScreen.ScreenWindow1:Screen1.ScreenWindow1:Screen2").ScreenItems("Rectangle1")

objRectangle.BackColor = RGB(255,0,0)

即:
Set objGroup = HMIRuntime.Screens("Main.PictureWindow1:ConMon.PictureWindow2:Overview").ScreenItems("Group1")

原创文章,作者:more0621,如若转载,请注明出处:https://www.zhaoplc.com/plc208436.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2017年11月6日
下一篇 2017年11月6日

相关推荐