GtkTreeView, GtkListStore and more...



Hi List!

I have a problem dealing with my GtkTreView and related objects.

In a first step, I need to add some rows to my GtkTreeView, so I used a pair
of:

   gtk_list_store_append(model,&iter);
   gtk_list_store_set(model,&iter,0,data1,1,data2,-1);

functions inside a loop.

After this, I will need to delete some elements in order to keep my list up
to date. My model is a GtkListStore.
So I need to rewind the Iter and then make it move one element at a time and
checking if it should be removed. I did something like this:

gtk_tree_model_get_iter_first(GTK_TREE_MODEL(model),&iter)

for(....){
  ...
  if(should_be_deleted)
       gtk_list_store_remove(model,&iter);

....
gtk_tree_model_iter_next(GTK_TREE_MODEL(model),&iter);
}

But this doesn't work, the first element is always deleted, so I'm not
"incrementing" the iter properly.

I tried doing:

   iter2=iter;
   gtk_list_store_move_after(model,&iter,&iter2);

to make the iter go after iter2 (who has the same position), but once again
the first element is always deleted....

Can you help me?

Thanks in advance.



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]