Re: [gtk-list] Setting Text BGcolor



Never mind.  I used the debugger to figure out what the different
members of a style were, and on a hunch, set base to be black.

Now, that I know how to do it, can someone explain why?

What is base supposed to be, and what is bg supposed to be?  That is, what
concept do they represent (in general terms applicable to all widgets).

On Sat, 4
Dec 1999, Rob Huffstedtler wrote:

> 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 
> 
> -- 
> To unsubscribe: mail -s unsubscribe gtk-list-request@redhat.com < /dev/null
> 
> 

=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=
  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]