Forum: Ruby-Gnome 2 Disable highlighting current row in treeview

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
Simon A. (Guest)
on 2008-10-11 21:49

I'm wondering is there is a setting to disable the automatic highlight
of the current row.

I'm using backgrounds colors in each cell to help the user know if the
cell is ok or need to be edited, but it does not appear for the current
row, where all the cells have a default background, from theme I guess,
which overrides whatever background I have set.

I tried to google it to no avail, and I don't see anything in the docs.

Anyone has an idea ?


Andrew S. Townley (Guest)
on 2008-10-12 18:17
(Received via mailing list)

You might be able to do something similar to what evolution does.
There's some color scheme "mucking" in mail/em-format-html-display.c
that computes "complimentary" colors.  There's also some algorithms that
I have somewhere that do some similar stuff, but I haven't thought about
them for quite a while.

I think you can just alter the selection color to be something along the
lines of what you want.  Shutting it off completely wouldn't be good
from a usability perspective.



On Sat, 2008-10-11 at 19:49 +0200, Simon A. wrote:
> I tried to google it to no avail, and I don't see anything in the docs.
> Anyone has an idea ?
> regards
> Maz
Andrew S. Townley <removed_email_address@domain.invalid>
Simon A. (Guest)
on 2008-10-14 00:10
Thanks, your answer directed me in the right direction.

There might be others solution, but I'm happy with what I've found.

Basically, by default, and from theme, the current row is highlighted.
Mainly setting a background color so you can easyly see which row you

You can change this color with Gtk::Widget#modify_base (seeGtk::Widget
doc), but it will still change the whole row.

I then went with disabling the selection, which did work just as I
wanted except you could not double clic a cell to edit it. So I added
this functionnality back. See below.

tw =
tw.selection.mode = Gtk::SELECTION_NONE
tw.signal_connect("row-activated") do |me, path, column|
  me.set_cursor(path, column, true)

It would have been nice to be able to modify style for each cell, but
I'm not sure it's feasible, and I don't want to spend more time on this,
as I have a solution which works exactly as I want it to.

Hope it can help

Roy W. (Guest)
on 2008-10-14 13:26
You can change the rendering on a cell by cell basis in the
TreeViewColumn.  Something like this which just sets the text bold or
normal depending on the output of the mythical foobar() method:

  col =
  col.set_cell_data_func(renderer) do |col, rend, model, iter|
    if model_column == MAP_TITLE[:COLUMN]
      highlight = foobar(col, rend, model, iter)
      weight = highlight ? Pango::WEIGHT_BOLD : Pango::WEIGHT_NORMAL)
      rend.set_property('weight', weight)
      rend.set_property('weight-set', 1)

This topic is locked and can not be replied to.