Re: Set background color into a Gtk::Treeview row



Hello Filipe,

I'm not sure that I have understand what you want to do.

If I got your point, you can define the wanted color in an hidden column
and set the color to the default color. Than you can implement the cell
renderer with the background color properties in your constructor and
add them to the view.

So when the user clicks on a row, you can as usual derefence the row and
set the hidden color column to the desired color. Than only the row wich
was clicked, has the new color because all other hidden column colors
are not touched.

If the user clicks on an other row, you can set the color back to your
standart color (wich is IMO normaly white).

In a db app, wich I wrote, I wanted to set every second row in an other
color.
So I implemented an own cell renderer with background properties. When I
fill My treeview, I set every second row with another color. In My app
it is quite useless, but I wanted to know how it works.

Bernd


Am Freitag, den 16.01.2009, 10:19 +0000 schrieb Filipe Apostolo:
> Hi Bernd,
> 
> Thanks for the quick answer, but I don't understand how to get the
> selected row Gtk::CellRenderer.
> I mean, supose at a moment an user activates a row and I want to change
> the background of all cell renderers. How can I obtain that row
> Gtk::CellRenderers' to change the background?
> 
> Filipe
> 
> Ok, but the
> Bernd Robertz wrote:
> > Hello,
> >
> > to set different background colors, you have to set up an own
> > Gtk::CellRenderer like in the pointed documentation.
> > To set the whole row, you have to do this for every column, because the
> > cell rendering is column based, not row based.
> >
> > Bernd
> >
> >
> > Am Donnerstag, den 15.01.2009, 18:20 +0000 schrieb Filipe Apostolo:
> >   
> >> Hi,
> >>
> >> I trying to set a different raw background when a user activates it.
> >>
> >> I have search and I found in the documentation how to set a different
> >> background to a desired column:
> >>     section: Specifying CellRenderer details
> >>     page:
> >> http://www.gtkmm.org/docs/gtkmm-2.4/docs/tutorial/html/sec-treeview.html
> >>
> >> I've searched the list archive but I couldn't find any solution.
> >> Can you point some examples?
> >>
> >> Best regards
> >> Filipe Apóstolo
> >> _______________________________________________
> >> gtkmm-list mailing list
> >> gtkmm-list gnome org
> >> http://mail.gnome.org/mailman/listinfo/gtkmm-list
> >>     
> >
> > _______________________________________________
> > gtkmm-list mailing list
> > gtkmm-list gnome org
> > http://mail.gnome.org/mailman/listinfo/gtkmm-list
> >
> >   
> 
> 
> _______________________________________________
> gtkmm-list mailing list
> gtkmm-list gnome org
> http://mail.gnome.org/mailman/listinfo/gtkmm-list



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