Re: [gtk-list] Re: Background color in GtkText
- From: Mario Motta <mmotta guest net>
- To: gtk-list redhat com
- Subject: Re: [gtk-list] Re: Background color in GtkText
- Date: Thu, 10 Sep 1998 11:41:10 +0200
On Tue, 08 Sep 1998, Robin Ericsson wrote:
>This is how I do it (almost, check the bezerk code for how the colors work):
>
>--- Code ---
>
> GtkWidget *text_field;
> GdkColor color_black;
> GdkColormap *cmap;
>
> color_black.red = 0;
> color_black.green = 0;
> color_black.blue = 0;
>
> cmap = gdk_colormap_get_system ();
> gdk_color_alloc(cmap, &color_black)
> gdk_window_set_background (GTK_TEXT (text_field)->text_area, &color_black);
>
>--- End Code ---
>
>And I think you have to do gtk_widget_show (); on the text widget before
>setting the background with gdk_window_set_background, but I'm not sure of that.
>
thanks, works fine.
just a little patch:
- gtk_widget_show() is'nt necessary
- assure that text widget is realized before setting background:
gdk_color_alloc(cmap, &color_black) ;
if(!GTK_WIDGET_REALIZED(text_field))
gtk_widget_realize(text_field);
gdk_window_set_background (GTK_TEXT (text_field)->text_area, &color_black);
--
Mario Motta
===========
AI Research Group - Rimini
mmotta@guest.net
http://www.guest.net/homepages/mmotta/index.htm
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]