Hi Muppet! On Sun, 9 Oct 2005 14:44:29 -0400, muppet said: [...]
Iters are good for the duration of a signal handler or function call, and are invalidated by changes to the model. What you've said suggests that you're storing iters, and that's not a valid thing to do.
Nope, I didn't store them, I did something like: $view->set_model (undef); $iter = $model->insert_before (undef, undef); $model->set ($iter, ...); $view->set_model ($model); And this failed on me. Perhaps I did something wrong. I will try it again this evening, using your code example as a guide. Ciao Florian
This is the basic idiom; i've written it for a list, but you can
expand that to a tree without much difficulty.
sub repopulate_list {
my $view = shift;
my $model = $view->get_model ();
# unset the model, so that the view doesn't waste time updating
# itself on every change to the model. we'll restore it below.
# typically the main loop won't run between now and then,
# so there should be no chance for the idle to run and paint
# an empty list (i.e., typically will not flicker).
$view->set_model (undef);
# if the model is sorted, you'd do well to disable sorting, too.
my $id = $model->get_sort_column_id ();
$model->set_sort_column_id (-2);
# now clear and refill the list.
$model->clear ();
foreach my $val (@big_list_of_data) {
$model->append ($model->append, 0, $val);
}
# re-enable sorting
$model->set_sort_column_id ($id);
# restore the model; this will redraw the whole thing.
$view->set_model ($model);
}
--
To me, "hajime" means "the man standing opposite you is about to hit
you with a stick".
-- Ian Malpass, speaking of the Japanese word for "the beginning"
Attachment:
pgpmNSEu1dWJg.pgp
Description: PGP signature