Re: background



The runtime error is because you must call
gtk_realize_widget() or gtk_widget_show() before
accessing text->window.

To set the text bg color, I think you want something like:

        GtkStyle *style, *style_default;

        gdk_color_parse ("red",&color);
        style_default = gtk_widget_get_default_style ();
        style = gtk_style_copy (style_default);
        style->base[GTK_STATE_NORMAL] = color;
        gtk_widget_set_style (text, style);


- Dermot


hello every body:
i would like to change the background of a text widget.

i wrote down:

GdkColor color;
gdk_color_parse("black",&color);

text=gtk_text_new();

gdk_window_set_background(text->window, &color);

i also tried:
gdk_window_set_background(GTK_TEXT(text)->text_area, &color);

when i run the app i get the following message:

Gdk-CRITICAL **: file gdkwindow.c: line 1233
(gdk_window_set_background): assertion `window != NULL' failed.

what's wrong with that???
Is there any way of changing the background color of a text widget???


_______________________________________________
gtk-app-devel-list mailing list
gtk-app-devel-list gnome org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list







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