RE: [gtkmm] Gtk::ListStore::insert, i can't get it working :(



> From: gtkmm-list-admin gnome org 
> [mailto:gtkmm-list-admin gnome org] On Behalf Of bart
> Sent: Donnerstag, 13. November 2003 14:43
> To: gtkmm-list gnome org
> Subject: [gtkmm] Gtk::ListStore::insert, i can't get it working :(
> 
> 
> Hi folks,
> 
> I've been trying for quite some time now, but i can't insert 

I assume that you are talking only about inserting rather than appending.
Appending is easy:
http://www.gtkmm.org/gtkmm2/docs/tutorial/html/ch08.html#id2880440

> rows in my listview. This has to be incredibly easy. So i;m 
> feeling kinda stupid :(
> 
> Anyway, the problem lies somewhere with the iterator, i use 
> the following code: ===========================================
> Gtk::TreeIter test;	
> row = *(liststore->insert( test )); 
> ===========================================
> row is a Gtk::TreeRow
> 
> when running i get this: 
> ===================================================
> Gtk-CRITICAL **: file gtkliststore.c: line 1143
> (gtk_list_store_insert_before): assertion `VALID_ITER 
> (sibling, list_store)' failed
> 
> gtkmm-ERROR **: file treeiter.cc: line 113 (void 
> Gtk::TreeIter::setup_end_iterator(const Gtk::TreeIter&)): assertion
> failed: (model_ == last_valid.model_)
> aborting... 
> ===========================================================
> 
> It seems i have to initialize the iterator, but how can i do 
> this? I've tried something like : ===================================
> test = liststore->iterator 
> ====================================
> etc....
> But nothing seems to work.

Admittedly the insert() method should be documented:
http://bugzilla.gnome.org/show_bug.cgi?id=117964
but it's meant to work like similar insert() methods in STL containers. The
iter parameter isn't just some crap that you have to provide to satisfy the
compiler - it tells the method _where_ to insert your row. I think
ListStore::insert() and STL insert() methods insert before (or maybe it's
after - We should write those docs).

Murray Cumming
www.murrayc.com
murrayc usa net



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