VisualHMI dropdown options: Static/Dynamic options, Numerical Conversion, and Historical Date

freeFree Technical Resource

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

Drop-down selection control forto selectfrom a predefined set of options: Click to open the drop-down list and select an item, which will be automatically synchronized to the associated variable. Options can be static content, dynamic content (written in LUA), or historical data dates.

1. Attribute introduction

1.1 Function settings

AttributesDescription
Display modeDrop-down or List
Monitoring addressBound variable address
Data typeUINT16/INT16/UINT32/INT32
Total items / List itemsTotal options; List display items (scroll bar drags when less than total items)
Menu directionAuto / Down / Up
Option contentStatic (fixed text) / Dynamic (variable address + max length, UTF-8, separated by semicolon;) / Historical data date (time of data recording control, with data sampling index + date format + sorting)
Numerical conversionConversion table: Each item corresponds to a value, such as options Item0~Item4 corresponding to values 1;

VisualHMI dropdown options: Static/Dynamic options, Numerical Conversion, and Historical Date插图

1.2 Appearance settings

  • Font/Size/Alignment/Text Color; Background Color/Selected Background Color (takes effect when background mapping is not enabled)
  • Reset dropdown menu: Menu item height (percentage of control height), menu item font (percentage)
  • Background image: Main display area gallery + List area gallery

VisualHMI dropdown options: Static/Dynamic options, Numerical Conversion, and Historical Date插图1

2. Application case

2.1 Static list + Numerical conversion

MonitoringLW1001(UINT16), 5 items, 3 items in list, text Item0~Item4, numerical conversion 1;

VisualHMI dropdown options: Static/Dynamic options, Numerical Conversion, and Historical Date插图2

VisualHMI dropdown options: Static/Dynamic options, Numerical Conversion, and Historical Date插图3

2.2 Dynamic list (written in LUA)

monitorLW1002, dynamic option content, variable addressLW1050The maximum length is 256 bytes. LUA uses set_string to write "ac;!?; Hello" (UTF-8, separated by semicolons), and the drop-down menu displays these three items.

VisualHMI dropdown options: Static/Dynamic options, Numerical Conversion, and Historical Date插图4

VisualHMI dropdown options: Static/Dynamic options, Numerical Conversion, and Historical Date插图5

2.3 Historical data date

MonitorLW2002Option content = historical data date, data sampling index [0], date format YYYY/MM/DD. Note: The variable address bound to the dropdown control = the control address of the data recording control + 2 (LW2000+2=LW2002). Configure the data recording control (data source = data sampling, channel 1, control address LW2000, timestamp positioning). Select the log date, and the data collection table will be positioned to the earliest entry of the current day.

VisualHMI dropdown options: Static/Dynamic options, Numerical Conversion, and Historical Date插图6

VisualHMI dropdown options: Static/Dynamic options, Numerical Conversion, and Historical Date插图7

The three dynamic options must be:① The string written by LUA must be UTF-8 encoded; ② Options are separated by semicolons (;); ③ The option content control must be written first before it is displayed—— When no content is written, the dropdown is empty. Don't think the control is broken.

Compiled from Guangzhou Dacai Technology VisualHMI development documentation (hmi-doc.gz-dc.com) configuration control tutorial "Dropdown Selection", copyright belongs to Dacai Technology.

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 *.