[Gtk-sharp-list] TreeCellDataFunc not getting pinged

Adam Tauno Williams awilliam at whitemice.org
Mon Apr 9 11:58:12 EDT 2007


In trying to port my code from NodeView to the more sophisticated
TreeView so that I can use the TreeModelFilter I've run into a problem.
The filter works, and the filter method is called for each item in the
ListStore.  But, while the TreeView displays rows, they can be clicked
(and appear highlighted) and the scroll window expands and contracts.
By all columns are blank.  The TreeCellDataFunc is never called [I put a
Console.WriteLine at the beginning of the function],  that is the
"RenderObjectId".

Gtk.TreeViewColumn      column;
Gtk.CellRendererText	cell;
TreeView		treeView;
TreeModelFilter		filter;

toDoView = new TreeView();
filter = new TreeModelFilter(taskStore, null);
filter.VisibleFunc = new Gtk.TreeModelFilterVisibleFunc(ToDoFilter);
toDoView.Model = filter;
column = new Gtk.TreeViewColumn ();
column.Title = "Object Id";
cell = new Gtk.CellRendererText ();
column.SetCellDataFunc(cell, new Gtk.TreeCellDataFunc(RenderObjectId));
column.PackStart(cell, true);
toDoView.AppendColumn(column);			

The "Object Id" column header is displayed, but all cells appear blank.

protected virtual void RenderObjectId(
	Gtk.TreeViewColumn _column, 
	Gtk.CellRenderer _cell, 
	Gtk.TreeModel _model, 
	Gtk.TreeIter _iter)
{
	Task task;
			
	Console.WriteLine("RenderObjectId invoked");
	task = (Task)_model.GetValue(_iter, 0);
	(_cell as Gtk.CellRendererText).Text = task.ObjectId.ToString();
} /* End RenderObjectId */



More information about the Gtk-sharp-list mailing list