RE: [gtk-list] Re: Background color in GtkText
- From: Robin Ericsson <lobbin lobbin ml org>
- To: gtk-list redhat com
- Subject: RE: [gtk-list] Re: Background color in GtkText
- Date: Tue, 08 Sep 1998 13:17:18 +0200 (CEST)
On 07-Sep-98 Mario Motta wrote:
> On Mon, 07 Sep 1998, tile@primenet.com wrote:
>>
>>
>>This is the step in the right direction, but you're using the wrong array.
>>Here's how I would do it...
>>
>>GtkStyle *style;
>>
>>...
>>
>>style = gtk_style_new ();
>>style->fg[GTK_STATE_NORMAL] = foreground;
>>style->text[GTK_STATE_NORMAL] = foreground;
>>style->base[GTK_STATE_NORMAL] = background; /* base not bg */
>>
>>gtk_widget_set_style (GTK_WIDGET (entry), style);
>>
>>Hope this helps.
>>
>>
> this seems to work for entry widgets, unfortunately not for text ones, (but
> should) anyway thanks for the answer, with pleasure i see that sometime
> someone in this list has the time to answer to numerous questions. A bit of
> statistics: i'm into the list since July and there three times less answers
> than questions.
> sincerely.
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.
---
''~``
( o o )
+-[Web - http://lobbin.ml.org/-------.oooO--(_)--Oooo.-------------+
| Robin Ericsson - System Administrator - HTML/PERL/C Hacker |
| Implementor of the mud The Shadow Rising - Soon to be open |
+-[eMail - lobbin@lobbin.ml.org]-----------------------------------+
-- How about a fortune?
Did I say 2? I lied.
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]