Re: [Glade-users] GtkListStore. (Multiple selection)



--- martine cs washington edu wrote:
On Thu, Oct 17, 2002 at 04:17:44PM -0700, Harring Figueiredo wrote:
My problem is that, when using *foreach(); we cannot delete any rows
because the remove() messes up the iter on the store/model.  Thus
cuases some rows to not be deleted and sometimes gives some ugly
error messages.

I am trying to think of a way to mark the selectect rows -- and I
guess I found a obscure way that works: Add a non-visible flag on the
model, and on the foreach function, I set it to true (meaning it was
selected -- after the foreach call is done, I loop through the model
and remove the rows I had set.

I ran into this, too.

Another solution, that don't require modifying your model:

Iterate through every row, calling gtk_tree_selection_iter_is_selected()
on each.  Remember to start again from the beginning if you delete the
row (because your iterator is invalidated).

A coauthor suggested possibly building a GList of GtkTreePaths... 
though I doubt they continue to refer to the same element if you 
delete an element, so iterate through the GList backwards (or just
build it list in reverse)...  but that's ugly and heavy.


For my project, I tried a bunch of different options and then found the
fastest one:  use foreach_selected to mark every selected row in the
internal data structure that the treeview was showing, then clear the
treeview and repopulate it from the data structure.  It's lame, but it
works. :\

-- 
      Evan Martin
martine cs washington edu
  http://neugierig.org
_______________________________________________
gtk-app-devel-list mailing list
gtk-app-devel-list gnome org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list



 This is exactly what I am doing --- but it will not be very practical from a
long list. -- oh well..

 Thanks for the reply.
HArring


__________________________________________________
Do you Yahoo!?
Faith Hill - Exclusive Performances, Videos & More
http://faith.yahoo.com



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