Re: selecting an iter in a single liststore



sorry for the late reply, you message got lost in the sea of
Gtk2-Extra's msgs.

On Fri, 2004-09-17 at 07:04, Alexandre Jousset wrote:

$iter = $ls->append;
$ls->set($iter, 0, 'three');
$sel->select_iter($iter);

i get the same behavior. it may be considered a bug in gtk+. that would
depend on whether or not what you're doing above is legal. you're trying
to select something before that something has been realized. selecting
may not be allowed or support until the list is visible on the screen.

if you change the above to

my $iter3 = $ls->append;
$ls->set($iter3, 0, 'three');

removing the select_iter call and then add

Glib::Idle->add (sub {
        $sel->select_iter($iter3);
        0;
});

just before the run it works fine. that being said it isn't safe to
assume that the iter is still good at this point. (iters are short
lived, if you use them outside of their original scope you are not
assured that they will work or even be valid. so really you should
select by path (or getting the iter again in the idle sub fromm the
path) or something like that in the above code. notice too that i'm
returning 0 from the idle so that it gets un-installed.

-- 
-rm
http://www.neces.com/




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