B4J Question Button color

red30

Well-Known Member
Licensed User
Longtime User
If I change the color of the button:
CSSUtils.SetBackgroundColor(btn,fx.Colors.ARGB(127,0,255,0))
The button is simply filled with one color. There is no gradient, when you hover over it with the mouse and when pressed, the button does not change color.
How to change the color, but at the same time that the remaining properties remain?
 

red30

Well-Known Member
Licensed User
Longtime User
I do not understand. Is this all done through the designer? I can not open the designer.
 
Upvote 0

red30

Well-Known Member
Licensed User
Longtime User
In Extra CSS:
B4X:
#btnsound {
    -fx-background-color: linear-gradient(#61a2b1, #2A5058);
}
#btnsound:hover {
    -fx-background-color: linear-gradient(#2A5058, #61a2b1);
}
#btnsound:pressed {
    -fx-background-color: black;
}
Gives an error message:
B4X:
дек 06, 2018 11:09:52 AM com.sun.javafx.css.parser.CSSParser parse
WARNING: CSS Error parsing '*{-fx-border-color:#000000;
-fx-border-width:0.00;
#btnsound {
    -fx-background-color: linear-gradient(#61a2b1, #2A5058);
}
#btnsound:hover {
    -fx-background-color: linear-gradient(#2A5058, #61a2b1);
}
#btnsound:pressed {
    -fx-background-color: black;
}}: Expected RBRACE at [3,0]
 
Upvote 0

red30

Well-Known Member
Licensed User
Longtime User
File CSS:
B4X:
#btnsound {
    -fx-background-color: linear-gradient(#61a2b1, #2A5058);
}
#btnsound:hover {
    -fx-background-color: linear-gradient(#2A5058, #61a2b1);
}
#btnsound:pressed {
    -fx-background-color: black;
}
Can I apply changes to a single button (btnsound)? How can I apply to ToggleButton?
 
Upvote 0
Top