[gtkmm] TreeView vs. TreeModel



Hi!

I wrote a small app which receives requests from another thread and add
a new row to a TreeModel upon each request. If I simply add the row like
this

  Glib::Mutex::Lock Lock (_Mutex);

  SupplyColumns Columns;
  Gtk::TreeModel::iterator iter = _refTreeModel->append ();
  Gtk::TreeModel::Row row = *iter;

  row[Columns._OrderId] = OrderID;
  row[Columns._State] = "OPEN";

the TreeView doesn't get updated if the mainloop doesn't receive an
event. If I move the mouse for example the new row is added.

So surfing through the docs leads me to
TreeModel::row_inserted(const Path& path, const iterator& iter) which
should (I think) signal the TreeView to update it's display.

A naive approach was simply adding following line after above code: 

  _refTreeModel->row_inserted (_refTreeModel->get_path (iter), iter);

But this leads to following critical message:

(supfe:17982): Gtk-CRITICAL **: file gtktreeview.c: line 3353 (gtk_tree_view_bin_expose): assertion `has_next' failed.
There is a disparity between the internal view of the GtkTreeView,
and the GtkTreeModel.  This generally means that the model has changed
without letting the view know.  Any display from now on is likely to
be incorrect.

How do I use row_inserted() to signal the TreeView. Or is there a better
way to fix this problem?

So long
Thomas

-- 
 .''`.  Calm yourself, Tubbs. None shall come... - Edward, Royston Vasey
: :'  : Thomas Krennwallner <djmaecki at ull dot at>
`. `'`  1024D/67A1DA7B 9484 D99D 2E1E 4E02 5446  DAD9 FF58 4E59 67A1 DA7B
  `-    http://bigfish.ull.at/~djmaecki/

Attachment: pgpogqsIhjAEL.pgp
Description: PGP signature



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