[Gtk-sharp-list] TreeStore.RowInserted event

Marcelo Belentani de Bianchi marcelobianchi at mail.com
Mon Mar 11 23:18:10 UTC 2013


Okay, that sounds pretty dummy. 
Also, will have to live with it.
thanks for the quick info, 

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


At 11 Mar 2013 18:10:11 +0000 (UTC) from "peter at peterjohanson.com" <peter at peterjohanson.com>:
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@<a target="_blank" target="_blank" href="lists.ximian.com">lists.ximian.com</a>>
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
<a target="_blank" target="_blank" href="http://sites.google.com/site/foo4funreborn/">http://sites.google.com/site/foo4funreborn/</a>
_______________________________________________
Gtk-sharp-list maillist  -  Gtk-sharp-list@<a target="_blank" target="_blank" href="lists.ximian.com">lists.ximian.com</a>
<a target="_blank" target="_blank" href="http://lists.ximian.com/mailman/listinfo/gtk-sharp-list">http://lists.ximian.com/mailman/listinfo/gtk-sharp-list</a>




More information about the Gtk-sharp-list mailing list