On Wednesday, 15 June 2016 at 21:39:37 UTC, TheDGuy wrote:
On Wednesday, 15 June 2016 at 20:49:02 UTC, Gerald wrote:
On Wednesday, 15 June 2016 at 09:03:45 UTC, TheDGuy wrote:
Hello,
why does this code not work?
RGBA rgb = new RGBA(1,0.5,0.5,1.0);
Button btn_1 = new Button("Start");
btn_1.overrideBackgroundColor(StateFlags.NORMAL, rgb);
The color of btn_1 just doesn't change.
https://developer.gnome.org/gtk3/stable/GtkWidget.html#gtk-widget-override-background-color
snip...
The text color is green but the button background color is
still default-gray!
I don't see an obvious issue with your code, I usually use CSS
classes personally and I know that works fine because I use this
technique all over terminix. I would suggest using the GTK
Inspector to debug the CSS issue, it's an awesome tool for
figuring out GTK CSS issues as it let's you change CSS on the
fly, see what CSS is being applied to an object, etc. You can see
how to use it at the link below:
https://wiki.gnome.org/Projects/GTK%2B/Inspector
I am also wondering how it is possible to change the button
color at runtime? In my opinion i don't think that CSS-based
style has alot of advantages over the commonly used object
functions.
Personally I just add and remove classes as needed:
getStyleContext().addClass()
getStyleContext().removeClass()