[Gtk-sharp-list] Filling a Gtk.TreeView with a Parent-Child object

Aphelion maurices at digiq.nl
Fri Jan 2 09:26:10 EST 2009


Hi everyone,

I am a C# Developer orienting Mono. To do this, i am writing a little
outliner application to get to know GTK#.

Currently i am experiencing difficulties with the Gtk.TreeView. What i want
to achieve: I have an object called TaskEntry. This taskEntry contains
properties like a Description and a DueDate.  It also has a
TaskEntryCollection containing Child Tasks.

I just cant find the right way to load my TaskEntry objects recursively to
the TreeView.

My current approach is the code below. However; it will not commit changes
to my objects this way. Can anyone help me into the right direction for
solving this problem?

	protected void FillTreeView()
	{		
		// Loop through the tasks and add them to the store
		foreach(TaskEntry task in _rootTaskEntry.Children)
		{
			Gtk.TreeIter taskIter = _outlineTreeStore.AppendValues(task);
			FillTreeView(taskIter, task);
		}
	}

	protected void FillTreeView(TreeIter taskIter, TaskEntry task)
	{
		foreach(TaskEntry childTask in task.Children)
		{
			TreeIter newIter = _outlineTreeStore.AppendValues(taskIter, childTask);
			FillTreeView(newIter, childTask);
		}
	}

-- 
View this message in context: http://www.nabble.com/Filling-a-Gtk.TreeView-with-a-Parent-Child-object-tp21251991p21251991.html
Sent from the Mono - Gtk# mailing list archive at Nabble.com.



More information about the Gtk-sharp-list mailing list