Re: How to set background/foreground on button, entry, or label?
- From: Owen Taylor <otaylor redhat com>
- To: Tony Denault <denault hawaii edu>
- Cc: gtk-list gnome org
- Subject: Re: How to set background/foreground on button, entry, or label?
- Date: Fri, 05 Mar 2004 15:46:07 -0500
On Thu, 2004-03-04 at 15:25, Tony Denault wrote:
> On Thu, 4 Mar 2004, Owen Taylor wrote:
> > On Wed, 2004-03-03 at 20:39, Tony Denault wrote:
> > > Hi All,
> > >
> > > After doing some research and hacking, I wrote some code to set the
> > > foreground / backgroud color of a button, entry, & label. This is still a
> > > confusing part of GTK 2.x., an internet search on this question resulted
> > > in lots of partial answers, vague description on how it should work,
> > > but no clear answer that work across all widgets.
> > Have you seen:
> > http://ometer.com/gtk-colors.html
> Yes, it was one of the references I came acoss while researching this
> subject. It indicated using gtk_widget_modify_fg/bg(), but I only
> got the fg to change for button&label. Could not get the entry text, or
> background colors for label, entry, button to change.
I suspect both of your issues are covered section of the doc titled
"Why doesn't setting the color work for me?"
"One possible reason is that the GUI element you want to
affect is actually drawn with the text, base, etc. color instead
of whatever color you are setting."
"Yet another possible reason is that some widgets don't have
backgrounds; e.g. label widgets. They merely display the background of
their parent (i.e. they are transparent). So set the background on
their parent; if you want to set the background of a rectangular area
around a label, try placing the label in a GtkEventBox widget and
setting the background on that."
] [Thread Prev