VisualHMI 控件权限:条件显示隐藏与使能禁止

freeFree Technical Resource

This content is free to read, suitable for basic learning and search traffic.

控件权限:满足条件才显示/可触控,最多两个条件组合(AND/OR)。比逐个画面叠控件干净得多。

1. 属性

field说明
条件地址判断用寄存器
比较==、!=、<=、>=、<、>、IN(范围内含边界)、OUT(范围外不含边界)
比较值;IN/OUT 时需填下限+上限
附加条件AND / OR,第二个条件
无权限时隐藏控件 / 禁止触控

VisualHMI 控件权限:条件显示隐藏与使能禁止插图

2. 单/双条件

单条件:LW1000==1 显示。双条件 AND:LW1000==1 且 LW1001==1 显示;双条件 OR:LW1000==1 或 LW1002==1 可触控。

VisualHMI 控件权限:条件显示隐藏与使能禁止插图1

VisualHMI 控件权限:条件显示隐藏与使能禁止插图2

VisualHMI 控件权限:条件显示隐藏与使能禁止插图3

3. 多条件(>2 个)

权限最多 2 个条件,3 个以上用 Lua 把多条件算成 1 个结果写回某寄存器,控件权限判这个寄存器:

function on_run()
  local v1 = get_uint16(VT_RW, 0x1000)
  local v2 = get_uint16(VT_RW, 0x1001)
  local v3 = get_uint16(VT_RW, 0x1002)
  if v1 == 1 and v2 == 1 and v3 == 1 then
    set_uint16(VT_RW, 0x1100, 1)
  else
    set_uint16(VT_RW, 0x1100, 0)
  end
end

VisualHMI 控件权限:条件显示隐藏与使能禁止插图4

控件权限最多 2 条件——别想着在界面里配 3 个 AND。超过就用 Lua 在 on_run 里算好写回一个寄存器,控件权限判那一个。注意 on_run 是周期回调,逻辑要轻。

整理自 广州大彩科技 VisualHMI 开发文档(hmi-doc.gz-dc.com)其他技术教程「控件权限」,版权归大彩科技所有。

Put this resource to use in a real project?

Go to the Tool Center for message parsing, CRC verification and device debugging, or submit your requirements for selection and integration advice.

Engineer Membership

Turn this article into actionable debugging resources

After activation, you can use advanced message parsing, resource pack downloads, code examples, engineering cases and priority technical support, suitable for real project delivery.

Unlimited Advanced Tools
Resource & Code Packs
Complete Engineering Case Library
Priority Technical Support

Leave a Reply

Your email address will not be published. Required fields are marked *.