GTK+ Forums

Discussion forum for GTK+ and Programming. Ask questions, troubleshoot problems, view and post example code, or express your opinions.
It is currently Thu Apr 17, 2014 6:45 pm

All times are UTC




Post new topic Reply to topic  [ 3 posts ] 
Author Message
 Post subject: Changing Row Background Colour in a Treeview
PostPosted: Thu Oct 10, 2013 11:25 am 
Offline
GTK+ Guru

Joined: Sun Jan 17, 2010 6:48 pm
Posts: 102
I have an application which uses the treeview to display a number of columns of data in a large number of rows. As part of that application I want to highlight rows under programme control by changing the cell background for each item in the highlighted row to yellow.

I believe that the right library call to set the row background in Gtk 2 is gtk_cell_view_set_background_color. Does anyone have a code example showing how to do this?

Many thanks in advance.

WJG

_________________
"If you don't stand for something, then you'll fall for anything."


Top
 Profile  
 
 Post subject: Re: Changing Row Background Colour in a Treeview
PostPosted: Mon Oct 14, 2013 7:19 pm 
Offline
Familiar Face

Joined: Wed Jan 30, 2013 8:28 pm
Posts: 20
you can use the style properties of your treeview get a look at:

https://developer.gnome.org/gtk3/3.8/GtkTreeView.html

particularly in this two links:

for set a color on even row:

https://developer.gnome.org/gtk3/3.8/Gt ... -row-color

for odd row:

https://developer.gnome.org/gtk3/3.8/Gt ... -row-color


Top
 Profile  
 
 Post subject: Re: Changing Row Background Colour in a Treeview
PostPosted: Sat Dec 07, 2013 12:05 am 
Offline
GTK+ Guru

Joined: Fri Mar 25, 2011 5:16 pm
Posts: 176
Location: USA
GTK 2.0 is quite old now. (GTK 4.0 is going to be released soon.) You should move to at least GTK+3.x
In GTK3.x the way to do it is through CSS, as nar6du14 has mentioned.
I've posted a tutorial in the section "Gtk+ Tutorials & Resources"

http://www.gtkforums.com/viewtopic.php?f=3&t=988&p=72417=Styling+GtkTreeView#p72417

For a full list of style-able properties click "Style Properties" in the upper right of the GTK manual page.
The following link will always give you the current stable version. Although styling for GtkTreeView hasn't changed through all of the GTK3.x series I would suggest always using the GTK manual for YOUR version because there are some differences among other widgets.

https://developer.gnome.org/gtk3/stable/GtkTreeView.html


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 3 posts ] 

All times are UTC


Who is online

Users browsing this forum: Vido, Yahoo [Bot] and 6 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group