Re: [Vala] [GTK+3] Setting colour for insensitive text



OK, I've got it, thanks to Valadoc.org. "Gtk.Widget.modify_text ()" is deprecated under GTK+3. One should use "Gtk.Widget.override_color ()" instead. The trap is that no warning messages are displayed when using it. Here is the corrected sample part :
var red = Gdk.RGBA ();
red.parse ("#ff0000");
[...]
entry.set_sensitive (false);
entry.override_color (StateFlags.INSENSITIVE, red); So simple...

tarnyko tarnyko net writes:
Hi folks, I have little problems setting colours for insensitive text in GTK entries. It used to work well with GTK+2, but with GTK+3 my choices seem to be ignored.
Here is a Vala sample to demonstrate the problem :
http://www.tarnyko.net/repo/testgtk-insensitive_text.vala The important part is :
Gdk.Color insensitive_color = Gdk.Color ();
Gdk.Color.parse ("red", out insensitive_color);
[...]
entry.set_sensitive (false);
entry.modify_text (StateType.INSENSITIVE, insensitive_color);
I first instantiate a "Gdk.Color" object and parse the "red" colour in it.
Then I make my Entry insensitive, and associate insensitive text therein with my Color object.
WORKS with GTK+2 :
valac --pkg gtk+-2.0 testgtk-insensitive_text.vala
DOESN'T WORK with GTK+3 :
valac --pkg gtk+-3.0 testgtk-insensitive_text.vala Text is red in GTK+2, stays gray in GTK+3. Could someone give me a direction ? PS : I want to avoid using CSS if possible.
Thanks, Tarnyko
_______________________________________________
vala-list mailing list
vala-list gnome org
https://mail.gnome.org/mailman/listinfo/vala-list



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]