Remove Multiple Rows from Gtk2::ListStore

Hi All,

I am having some trouble removing multiple rows. I have a button called Remove that when clicked I want to be 
able to remove any selected rows.

At first I tried this:

        $selection->selected_foreach(sub {
            my ($model,$path,$iter) = @_;


But this gives the following warning:
Gtk-WARNING **: The model has been modified from within gtk_tree_selection_selected_foreach.
This function is for observing the selections of the tree only.  If you are trying to get all selected items 
from the tree, try using
gtk_tree_selection_get_selected_rows instead.

So then I tried:

        my @paths = $selection->get_selected_rows;
        foreach my $p (@paths)
            my $iter = $model->get_iter($p);

But when I select multiple rows and try to remove them it gives this error:
*** unhandled exception in callback:
***   variable not allowed to be undef where GtkTreeIter is wanted at line 654.

Line 654:             $model->remove($iter);

Could someone show me the best way to remove multiple rows?

Many thanks,


See what's on at the movies in your area. Find out now:

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