[Gtk-sharp-list] TreeStore.RowInserted event

peter@peterjohanson.com peter at peterjohanson.com
Mon Mar 11 18:10:11 UTC 2013


Unfortunately, this is thanks to the behaviour of GtkTreeStore itself, which, as you have discovered, actually first inserts an empty row, then sets the data for that row. I'm not aware of any way to alter that behaviour, other than detecting when it occurs. 

-pete

Sent from my HTC One™ X

----- Reply message -----
From: "Marcelo Belentani de Bianchi" <marcelobianchi at mail.com>
To: <gtk-sharp-list at lists.ximian.com>
Subject: [Gtk-sharp-list] TreeStore.RowInserted event
Date: Mon, Mar 11, 2013 1:27 PM


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/
_______________________________________________
Gtk-sharp-list maillist  -  Gtk-sharp-list at lists.ximian.com
http://lists.ximian.com/mailman/listinfo/gtk-sharp-list

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.ximian.com/pipermail/gtk-sharp-list/attachments/20130311/ce53dcba/attachment.html>


More information about the Gtk-sharp-list mailing list