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" <[email protected]>
To: <[email protected]>
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
-- 
[email protected]
http://sites.google.com/site/foo4funreborn/
_______________________________________________
Gtk-sharp-list maillist  -  [email protected]
http://lists.ximian.com/mailman/listinfo/gtk-sharp-list

_______________________________________________
Gtk-sharp-list maillist  -  [email protected]
http://lists.ximian.com/mailman/listinfo/gtk-sharp-list

Reply via email to