Re: GtkTreeView row color change



Am Fre, 2002-12-06 um 14.21 schrieb Oistein Aanensen:
> Just a quick question about this issue:
> 
> Since the GtkCList is now deprecated I assume there must be a way of
> changing the background color of independent rows in a GtkTreeView
> somehow? However i'm not able to figure out how. I can change the
> backgound color of a column using the renderer but not rows.
> 
Hi Oistein,
this feature is implemented since Gtk+2.1.0, it is not in stable version
2.0.x!
At first create a column in your model with type G_TYPE_STRING,

then you must create a column in the view for background like:

column = gtk_tree_view_column_new_with_attributes(uft8string,
	render,"active", index,
"cell-background",number_of_background_column_in_model, NULL);

at last put in the model the information about the color:

gtk_list_store_set(GTK_LIST_STORE(treedata),&iter,col,"red",-1);

Excuse my bad English, but I hope I can help.
MfG Bernd



-- 
Bernd Demian <bdemian csc-dd de>
CSC Ploenzke




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