Re: How to change GtkEntry background
- From: Paul Davis <pbd Op Net>
- To: Paul Foley <mycroft actrix gen nz>
- Cc: gtk-list gnome org
- Subject: Re: How to change GtkEntry background
- Date: Tue, 05 Mar 2002 04:23:28 -0500
>I want to display some data in an array of Entry widgets, and I'd like
>to change the text background on a per-widget basis to represent a few
>bits of other data associated with each entry. Is it possible? I can
>only get a single-pixel-width line around the border to change colour,
>which is not very helpful.
>
>The colours have to change whenever the content changes.
>
>[What I'd _like_ to be able to do is something like
>
> gtk_widget_set_named_style(my_widget, "foo")
>
>to make the widget use a style "foo" defined in an rc file]
you're working against the design of GTK+. it is intended that there
are 2 levels of connection, not 1, between a widget and a GTK RC file
style:
* first, define the style and name it
* second, define what style to use for widgets with a certain name
so, in your case, you need a RC file like
style "foo" {
... style definition ..
}
widget "*Foo" style "foo"
and then in your code:
gtk_widget_set_name (widget, "Foo");
the "*Foo" has an asterisk because the name of widget is actually a
period-separated concatenation of each nested container from the top
level window down to the widget itself. You might have a full widget
name of "GtkWindow.GtkHBox.GtkVBox.GtkFrame.Foo". By using "*Foo", you
don't have to worry about how or where your widget is packed.
--p
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]