Re: Setting the background color of a GtkEntry



The white part of a text-accepting widget uses the "base" color, not
the "bg" color.  The only way I know to set that is with a style:

style "myEntry"
{
    base[NORMAL] = "#ff0000"    # or whatever
}
class "GtkEntry" style "myEntry"

You can load this setting by placing that text in a file called "foo"
and then calling gtk_rc_parse("foo"), or you can put it in a string
called "bar" and call gtk_rc_parse_string(bar).

This is some progress... However, what I want to achieve is to dynamically
change the background color without reopening the window (what I want to use the
color change for is validating input - if something's wrong then the entry goes
red, if the entry gets corrected it should be white again). Is it possible to
force a refresh and instantly change the background color of the GtkEntry? When
I use gtk_rc_parse_string() in the callback, it works, but the entry's color is
changed after i TAB a few entries forward.

Thanks again for any hints,
Michal Kepien



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