Re: TreeView Questions



In response to:

"The way I did it in my program was via a gtk_cell)renderer_text property..
http://developer.gnome.org/doc/API/2.0/gtk/ GtkCellRendererText.html
if you look at the property's there you see you can set "foreground-gdk"

code:
renderer =  gtk_cell_renderer_text_new();
column = gtk_tree_view_column_new_with_attributes("Priority", renderer,
"text" , PRIOSTR,"strikethrough", DONE,"foreground-gdk", COLOR, NULL);

(COLOR is an enum for the row with the color setting)"





I have tried what you suggested and have come up short.  I must be missing something.  Here is what I did:



list = gtk_list_store_new (3, G_TYPE_STRING, G_TYPE_STRING,GDK_TYPE_COLOR);

renderer = gtk_cell_renderer_text_new ();

column = gtk_tree_view_column_new_with_attributes (" ",renderer,"text",0,"foreground-gdk",2,NULL);

gtk_tree_view_append_column (GTK_TREE_VIEW (clist), column);

column = gtk_tree_view_column_new_with_attributes (" ",renderer,"text",1,NULL);

gtk_tree_view_append_column(GTK_TREE_VIEW (clist), column);

This was then appended to my TreeView.  I then go on to this line in a portion of my program:

gtk_list_store_set (GTK_LIST_STORE(list), &iter,2,&color1,-1);

Where color1 is defined as:


GdkColor color1;
color1.blue=1000;
color1.green=1000;
color1.red=65000;

Upon executing the set command, the text in the row that it was performed on turns blue, no matter what I do 
to color1.  I can even leave color1 uninitialized and the first column blanks out with a gtk warning msg but 
the second column in the row iter is pointing to turns blue.  Whats the deal?  It changes color but not to 
what I am providing.  I also get error msg in the terminal stating this:


 Gtk-WARNING **: gtkliststore.c:853: Invalid column number 65601000 added to iter (remember to end your list 
of columns with a -1)


The set commands prompt this.  If I comment them out they vanish.

Any ideas?  Have I done something incorrect?


Thank you,
David Swiston



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