B4J Question Change color of slider, checkbox using CSS

red30

Well-Known Member
Licensed User
Longtime User
I can change the colors of the buttons using the CSS. For instance:
CSS:
.button {
    -fx-background-color: #095db1;
}
.button:hover {
    -fx-background-color: #265685;
}
.button:pressed {
    -fx-background-color: #033c73;
}
.button:disabled {
    -fx-background-color: #959595;
}
If I try to do the same for the slider, then I only fill in the background. How for a slider can I change the colors of a separate scale and a separately moving element?
If I try to change the color for the checkbox, but nothing happens at all. How can I change colors for a checkbox? Separately of that field where I put a tick?
 

Erel

B4X founder
Staff member
Licensed User
Longtime User
You can use B4XSeekBar from XUI Views:
firefox_SLBrlt4Hga.png


It is cross platform and easy to customize.
 
Upvote 0

red30

Well-Known Member
Licensed User
Longtime User
You can use B4XSeekBar from XUI Views:
firefox_SLBrlt4Hga.png


It is cross platform and easy to customize.
I would like to work with a standard slider, but if this is not possible, I will have to go to XUI Views. Can I make such a slider using XUI Views?
333.png

I found code on the forum that can change the color of the slider bar.
B4X:
Sub SliderTrackColorRGB(slr As Slider, Color As String)
    Dim joSldr As JavaObject = slr
    joSldr.RunMethodJo("lookup", Array(".track")).RunMethod("setStyle", Array($"-fx-background-color:${Color};"$))
End Sub
As far as I understand, color changes using CSS. But can I myself manually use CSS to change the light of the slider scale and the color of the moving part of the slider?
Another question: is it possible to somehow change the color of the checkbox?
 
Upvote 0
Top