Re: [gtkmm] TreeView assertion "has_next" failed



Murray Cumming wrote:

On Sat, 2004-04-17 at 20:28, Sverre Sundsdal wrote:
Hello.
I have a custom ListViewModel where elements are inserted dynamically. First I add the element to the STL vector, then I use the following code to update the treeview.

  Gtk::TreeNodeChildren allNodes = mListModel->children();
   Gtk::TreeNodeChildren::size_type numNodes = allNodes.size();
   Gtk::TreeModel::Path path;
   path.push_back(numNodes);
   Gtk::TreeModel::iterator iter = mListModel->get_iter(path);

It would be good to check that the  iter is valid here, with an
if(iter)
{
}
(I'm working with Sverre on this project...)

We tried that, and the iter is valid.

   mListModel->row_inserted(path, iter);

Why are you calling this method? I don't know when anybody would need to
call it.
On March 27, I submitted a post about this, titled "Updating a custom TreeModel", where I explained that when I add objects to my std::vector<User>, which is the vector holding the actual data to be displayed in the TreeView, nothing happened. It seemed logical that the TreeModel needs to know that the vector has changed its contents, and Christer Palm told me that row_inserted was the function that telling the TreeModel that a new row was available.

Have I misunderstood this? Or am I misinformed? I see there is a signal_row_inserted()... does that do me any good?

Well, I don't know. I _do_ know that currently - without the above line, the treeview doesn't update itself when new data is available (and I don't just mean update as in _draw_). _With_ the above line, the treeview is updated, but I get the Gtk-Critical assertion errors...

Any help is appreciated...

--
Tor Arvid Lund               ,''`.
http://totto.homelinux.net  : :' :
GnuPG key ID: 0xF335ED1E    `. `'
find it at pgp.mit.edu        `-

Attachment: signature.asc
Description: OpenPGP digital signature



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