Page 1 of 1

Dropdown list + auto change color?

Posted: Sun Mar 21, 2021 12:36 pm
by MikinaneShindouda
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?

Re: Dropdown list + auto change color?

Posted: Sun Mar 21, 2021 1:20 pm
by TimFun13
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.

Re: Dropdown list + auto change color?

Posted: Sun Mar 21, 2021 1:47 pm
by MikinaneShindouda
ShyTwig16 wrote:
Sun Mar 21, 2021 1:20 pm
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.
im just start cheating 2 days ago. i need a full tutorial how to do it. pls :D

Re: Dropdown list + auto change color?

Posted: Sun Mar 21, 2021 4:26 pm
by TimFun13

Re: Dropdown list + auto change color?

Posted: Sun Mar 21, 2021 5:01 pm
by MikinaneShindouda
ShyTwig16 wrote:
Sun Mar 21, 2021 4:26 pm
how is this help me

Re: Dropdown list + auto change color?

Posted: Sun Mar 21, 2021 8:00 pm
by predprey
ShyTwig16 wrote:
Sun Mar 21, 2021 1:20 pm
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.
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
Should be rather simple if you know Lua which you're probably going to find useful if you're going to be making tables or CE trainers regularly. Rather than waiting for someone to post some readily working code, CEF forums is very helpful ;)