Re: Top Window Background



Andy Grebe wrote:
I've got a callback function where I want to change the background of
the entire window.  I can set the color on startup using:

style = gtk_widget_get_style(topWindow);
style->bg[0] = c;
style->bg[1] = c;
style->bg[2] = c;
style->bg[3] = c;
style->bg[4] = c;
gtk_widget_set_style(topWindow, style);

but when I attempt to change the color of the background in a callback
function, it doesn't work.  I've also tried the modify_bg function with
the same results.


The right approch is indeed gtk_widget_modify_bg():
GdkColor color;
gdk_color_parse("red", &color);
gtk_widget_modify_bg(GTK_WIDGET(window), GTK_STATE_NORMAL, &color);

Note that the widget must be in the right state.

Cheers,

Andy



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