Setting Text BGcolor
- From: Rob Huffstedtler <rob bagpipe com>
- To: GTK List <gtk-list redhat com>
- Subject: Setting Text BGcolor
- Date: Sat, 4 Dec 1999 12:32:59 -0600 (CST)
How do I go about setting the background colour of a text widget? I
thought that it would be by creating a style and applying it to the
widget, somethine like:
GtkStyle *defstyle; /* The default style */
GtkStyle *style;
GdkColor black = { 0, 0x0000, 0x0000, 0x0000};
GdkColor white = { 0, 0xffff, 0xffff, 0xffff};
gchar *msg = "This message is a placeholder. Someday, an "
"actual status box will live here.";
/* --Allocate the colors-- */
gdk_color_alloc(gdk_colormap_get_system(), &white);
gdk_color_alloc(gdk_colormap_get_system(), &black);
defstyle = gtk_widget_get_default_style();
style = gtk_style_copy(defstyle);
/* Set the colours */
style->fg[GTK_STATE_NORMAL] = white;
style->text[GTK_STATE_NORMAL] = white;
style->bg[GTK_STATE_NORMAL] = black;
text = gtk_text_new(NULL, NULL);
/* --Set the style of the widget-- */
gtk_widget_set_style(GTK_WIDGET(text), style);
Which does seem to change the text color (I can't see the text anymore),
but the background is still white (the border of it now seems to be black,
though).
=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=
Rob Huffstedtler Please visit Linux University
(931) 596-3560 www.linuxuniversity.org
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]