Gtk::TreeView cell background color



When I add a Gtk::TreeModelColumn<bool>, which uses a Gtk::CellRendererToggle, to a Gtk::TreeView and try to change the cell color I get a seg fault.
Is this a bug or am I doing something wrong.  All other columns work...


tv->append_column_editable( "Test", Columns.m_col_test );


void ColorRows( Gtk::TreeView* treeview ){

   Gtk::CellRendererText* cell_renderer_text;
   Gtk::TreeViewColumn* color_column;
   vector<Gtk::TreeViewColumn*> columns = treeview->get_columns();
   Gtk::TreeModel::Children children = treeview->get_model()->children();
   Gtk::TreeModel::Row row;
   CModelColumns ModelColumns;
for( int x = 0; x < children.size(); x++ ){ row = *(children[x]); if( (x % 2) == 0 ) row[ModelColumns.m_col_color] = "grey"; else
           row[ModelColumns.m_col_color] = "white";
for( int y = 0; y < columns.size(); y++ ){ color_column = treeview->get_column(y); Gtk::CellRenderer* cell_renderer = color_column->get_first_cell_renderer(); cell_renderer_text =
                       dynamic_cast<Gtk::CellRendererText*>(cell_renderer);
color_column->add_attribute(cell_renderer_text->property_cell_background(), ModelColumns.m_col_color); // <----------segmentation fault
       }
   }
}

--
Jason Burchfield
CAS, Inc.
(256) 971-6096
Jason Burchfield cas-inc com




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