[Gtk-sharp-list] TreeStore.RowInserted event

Marcelo Belentani de Bianchi marcelobianchi at mail.com
Mon Mar 11 17:27:21 UTC 2013


Dear List, 

I am a new user to the gtk-sharp package and I am having some dificulties with the TreeStore object.
After I created my object as:

store = new TreeStore(typeof(object));

I attach it to the TreeView.model as 

treeViewer.Model = store;

And also I associate the RowInserted event to a method where I would like to retrieve the item inserted like in:

store.RowInserted += delegate(object o, RowInsertedArgs args) {
	TreeStore _store = (TreeStore) o;
	object assoc_obj = _store.GetValue(args.Iter, 0);
	if (assoc_obj == null){
		throw new Exception("Invalid Object inserted into the tree.");
	}
};

When I run my code the Exception is alway throw. Why does I cannot retrieve the object ? It looks like that when I run the following command:

TreeIter it = store.AppendValues(ss);

to insert the object into the store the row is created empty, the event is triggered and after that the object ss is attached to the row because I managed to fetch the object from the RowChanged event (that by the way is triggered for every object I insert if i create the store with more than one place to put objects). Is this the correct behaiviour ? There is someway to control when the event is triggered ? Some flags on the TreeStore ?

I appreciate any comments,

with my best regards, 

Marcelo Bianchi
-- 
marcelobianchi at mail.com
http://sites.google.com/site/foo4funreborn/


More information about the Gtk-sharp-list mailing list