Slider value TextField.Backcolor Solved

Hello, (Never mind ReadOnly was on, now that it’s off all is well)

Windows 10…
Xojo 2015 R 4.1

I have this code in a timer…

[code]TextField1.Text = Str(Slider1.Value)
dim samt,eamt as double
dim e, s As Color

s = &c00FF00
e = &cFF0000

samt = 1 - (Slider1.Value/Slider1.Maximum)
eamt = Slider1.Value/Slider1.Maximum

TextField2.BackColor = rgb((s.red * samt) + (e.red * eamt), (s.green *samt) + (e.green * eamt), (s.blue * samt) + (e.blue * eamt))

TextField2.Invalidate   'TextField2.Refresh[/code]

TextField1.Text updates as the slider is moved but TextField2.BackColor does not any at all.

What could be the problem? and how can I fix that?

Thanks.

Lennox

probably because you color never changes?

if slider max is 100
and slider value it 25
samt=0.75
eamt=0.25

which totals 1.00

and slider value it 33
samt=0.66
eamt=0.33

which total 0.99 (ie. 1.00)

so what changes?

Thanks Dave, Never mind ReadOnly was on, now that it’s off all is well.

Thanks again.

Lennox

If you use this button in the bottom right of your post the thread will automatically be marked as answered/solved.

You can even click it on your own post above :slight_smile:

Thanks Julian,

Lennox