Re: How to set background/foreground on button, entry, or label?



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.

As I stated before, if there is a better technique for gtk 2.0, please
modify the code and post.

gtk_label directly renders onto the parent (it doesn't have its own window).
You can change the text foreground and background colour with pango, but
the whole background of the label can be changed by holding it in a
gtk_event_box, and changing the fg colour of that (it derives from gtk_widget).
Looking in the header file may tell you if a widget has its own window.



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