Remove Multiple Rows from Gtk2::ListStore
- From: Zettai Muri <zettaimuri ymail com>
- To: gtk-perl-list gnome org
- Subject: Remove Multiple Rows from Gtk2::ListStore
- Date: Wed, 16 Dec 2009 11:24:36 -0800 (PST)
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) = @_;
$model->remove($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);
$model->remove($iter);
}
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,
ZM.
__________________________________________________________________________________
See what's on at the movies in your area. Find out now: http://au.movies.yahoo.com/session-times/
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]