Re: [gtk-list] clist row color



On Mon, Jun 07, 1999 at 10:54:38PM -0500, Key, Chris wrote:
> background color to this color?  The code I have should be doing it (no
> compile/run errors), but it does not update the row, so I am not sure if the
> color attribute is being set.

Funny, I just had the same problem, but got it fixed after looking at
the text example. Here is the gist of it:


	GdkColor gamestalker_red    = {0, 0xffff, 0, 0};
	GdkColor gamestalker_green  = {0, 0, 0xcccc, 0};
	GdkColor gamestalker_blue   = {0, 0, 0, 0xffff};

	GdkColormap *colorMap = gdk_colormap_get_system();

	gdk_color_alloc(colorMap, &gamestalker_red);
	gdk_color_alloc(colorMap, &gamestalker_blue);
	gdk_color_alloc(colorMap, &gamestalker_green);

	gtk_clist_set_foreground(GTK_CLIST(list), row, &gamestalker_blue);


Note that this is test code. Please check all return values
appropriately. The sticking points for me were:

1) I was initialzing the red, green, and blue values as 8 bit's per,
when they need to be 16 bits per (right everyone?).

2) I started out using gdk_colormap_alloc_color which didn't seem to
be working for me.

Hope this helps!
rjf&



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