[Glade-users] background on label



"Dennis L. Goyette Sr." wrote:

anyway to change the background color on a label widget????

This is covered in the FAQ:

2.2 How do I change the colors of a widget, e.g. make a label red?

You can use standard GTK+ rc files to set the colors & fonts of your
widgets.
If you turn on the 'Set Widget Names' project option in Glade, that may
make
it easier to refer to your widgets, as you can refer to them by name.
See the GTK+ Resource Files documentation at
http://developer.gnome.org/doc/API

You can also change a widget's style within your code by calling
gtk_widget_modify_style(), e.g.

  GdkColor red = { 0, 65535, 0, 0 };
  GtkRcStyle *rc_style = gtk_rc_style_new ();
  rc_style->fg[GTK_STATE_NORMAL] = red;
  rc_style->color_flags[GTK_STATE_NORMAL] |= GTK_RC_FG;
  gtk_widget_modify_style (widget, rc_style);
  gtk_rc_style_unref (rc_style);



Note that labels do not draw their own background, so you may need to
place it in a GtkEventBox and set the background of that instead.

Damon







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