I want the dropdown list to auto change color.
example: i have 0:OFF , 1:ON and 2:ERROR.
I want OFF show as black color in table value, ON show as green and ERROR show as red.
whenever the value change so do the color change.
any idea?
Dropdown list + auto change color?
- MikinaneShindouda
- Expert Cheater
- Posts: 71
- Joined: Mon Sep 25, 2017 7:30 pm
- Reputation: 89
Re: Dropdown list + auto change color?
You could use a timer, and check the value then change the memory records color as needed. Or you could use "OnGetDisplayValue" to set the color of the memory record.
- MikinaneShindouda
- Expert Cheater
- Posts: 71
- Joined: Mon Sep 25, 2017 7:30 pm
- Reputation: 89
- MikinaneShindouda
- Expert Cheater
- Posts: 71
- Joined: Mon Sep 25, 2017 7:30 pm
- Reputation: 89
Re: Dropdown list + auto change color?
This is plenty of help already as it is. You can refer to Lua tutorials on the main CEF forums, but the general pseudocode could:
Code: Select all
--sets function for all memrecs, but you can alternatively check for specific indexes or descriptions if you don't want that
al = getAddressList()
for i = 1, al.Count then
al[i].OnGetDisplayValue = function(mr, value)
if value == 0 then
mr.Color = integer for black # i'm guessing you can specify these using hex values like so 0x00000000
elif value == 1 then
mr.Color = integer for green #0x00FF00
elif value == 2 then
mr.Color = integer for red #0xFF0000
end
end
![Wink ;)](./images/smilies/icon_e_wink.gif)
Who is online
Users browsing this forum: No registered users