Re: GtkTreeView possibilities to set text propertys on individual columns



Mikael Hermansson <mikeh bahnhof se> writes:

> > ("Message/commands",
> > > cell, "text", 2,"foreground",3, NULL);
> > >   gtk_tree_view_append_column (GTK_TREE_VIEW (app->treeview), column);
> > 
> > First of all, you should be using different cells here.  While you can
> > share a cell between columns, you should only do that if you are setting
> > identical attributes.  In this case, you will have the red color 'bleed'
> > from the third column into the next lines first two columns.
> > 
> 
> Yep! I wanted to have the same color on all rows:
> 
> changed to:
> 
> cell=gtk_text_cell_new();
> gtk_tree_view_column_new_with_attributes("col1",cell,"foreground",0, "text"
> ,1, NULL);
> gtk_tree_view_column_new_with_attributes("col2",cell,"text", 2, NULL);
> gtk_tree_view_column_new_with_attributes("col3",cell,"text",3, NULL);
> 
> and:
> 
> gtk_tree_store_set(iter,1 ,"red", 2,"data1", 3, "data2",4, "data3",-1);
> 
> And this should be right (Atleast it works :-)?

It works for now, but we'll probably break it later.  For example, it
assumes that you are going from col 0 to col 1 to col 2.  If you get an
expose event in the last column, right now it's redrawing the entire
row.  However, we'd like it to only draw the effected column later -- in
which case you won't have the foreground set.

You should really just do:

cell=gtk_text_cell_new();
gtk_tree_view_column_new_with_attributes("col1",cell,"foreground", 0, "text" ,1, NULL);
gtk_tree_view_column_new_with_attributes("col2",cell,"foreground", 0, "text", 2, NULL);
gtk_tree_view_column_new_with_attributes("col3",cell,"foreground", 0, "text", 3, NULL);

etc.

Thanks,
-Jonathan




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