Re: liststore update question



B McAndrews said:
I have liststore setup with an appropriate view. The model was initially
set with data from database.  I can get updates from the database, but
I'm unsure as to how I go about updating the model and subsequently the
view.  Rows won't be added or deleted, so I thought of something I could
cache the iterators that were created at initialization, but I'm not
sure that would work.  Can anyone  help me here?

The iters are not guaranteed long lifetimes, so you do not want to cache them.
 Instead, you'd use a Gtk2::TreeRowReference, which is guaranteed to point to
the right place, even if the data in the list changes, so long as the row
exists.

http://developer.gnome.org/doc/API/2.0/gtk/GtkTreeModel.html#gtk-tree-row-reference-new
and http://gtk2-perl.sourceforge.net/doc/pod/Gtk2/TreeRowReference.html


After that, as far as i know, when you do

  $model->set ($iter, COL1 $val1, COL2, $val2, ...);

the view should update automatically, with no intervention from you.  In fact,
i've been looking for a way to freeze/thaw the liststore during large updates;
i think $object->freeze_notify and thaw_notify are supposed to work here.

-- 
muppet <scott at asofyet dot org>



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