2

I'm attempting to color disabled rows in a gtk tree view widget a light gray color. From what I've read, I'm supposed to set the background-gdk property of the corresponding cellrenderer and bind it to a model column. This sort of works.

Gtk::CellRendererText* textRenderer = manage(new Gtk::CellRendererText());
textRenderer->property_editable() = false;
Gtk::TreeViewColumn *col = manage(new Gtk::TreeViewColumn("Column1", *textRenderer));
col->add_attribute(*textRenderer, "background-gdk", m_treeview_columns.m_back_color);
my_treeview.append_column(*col);

Gtk::TreeModel::Row row;
for (int i = 0; i < NUMBER_OF_ROWS; iLane++){
   row = *(treeview_liststore->append());
   row[m_workListColumns.m_back_color] = Gdk::Color("#CCCCCC");
}

alt text

In the end though, I get only the cells colored properly. BUT I also get an ugly white-space in between the cells. Does anyone know of a way to fix this or a better way to achieve the effect I'm after?

gpoo
  • 8,408
  • 3
  • 38
  • 53
Mark
  • 106,305
  • 20
  • 172
  • 230

1 Answers1

4

Could you set the background of the row to match the cell background or set the bakground of the tree view all together ? Or maybe the cell with cell-background-gdk ?

ivo s
  • 104
  • 2
  • 2
    Thanks @ivo s, I was using the wrong property, I needed "cell-background-gdk" and not "background-gdk". Thanks for the help. – Mark Nov 16 '10 at 18:08