- HMI Model: MT8107ie
- EasyBuilder Pro Version: V6.10.01.465
How to change the background of a numeric object if the value does not in range standard? The standard i build dynamic
none
0.0
0
Hi @liaaa ,
To change the background color based on a numeric value, we recommend layering a Word Lamp behind a Numeric object (set the Numeric’s background to None). Then, use a macro to set the Word Lamp’s background for the states you need.
Below are a demo project and the macro I used. Feel free to modify them as needed.
macro_command main()
short num
short state
// Read the value from LW10
GetData(num, "Local HMI", LW, 10, 1)
// Evaluate range and set state accordingly
if num == 0 then
state = 1
else if num <= 20 then
state = 2
else
state = 3
end if
// Write the result to LW0
SetData(state, "Local HMI", LW, 0, 1)
end macro_command
Post if needed to create multiple states within a Word Lamp using the Picture Library