progress bar color



Hi,
I'm still having a problem changing the color of a progress bar in one of
my programs using gtk 2.0. I've extracted the offending code into a
trivial test program and I still can't make it work. Can anyone tell me
what I'm doing wrong? I've modified the colors of various other widgets in
the app and these work fine. I'm sure I've done this under gtk1.2 using
modify_style and it worked ok then.

gint main(gint argc,gchar *argv[])
{
	GtkWidget *window;
	GtkWidget* bar;
	GdkColor color;

	gtk_init (&argc,&argv);
	window=gtk_window_new(GTK_WINDOW_TOPLEVEL);
	bar=gtk_progress_bar_new();
	gdk_color_parse("red",&color);
        gtk_widget_modify_bg(bar,GTK_STATE_PRELIGHT, &color);
	gtk_progress_bar_set_fraction(GTK_PROGRESS_BAR(bar),0.5);
	gtk_container_add(GTK_CONTAINER(window),bar);
	gtk_widget_show_all (window);
	gtk_main();
	return 0;
}

Nick Soffe.





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