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



Hi Murray,

I'm always posting a little bit to soon ;) I just found out how to do
it:
==================================================================
Gtk::TreeIter test = liststore->children().begin();
//here i can do something with test
row = *(liststore->insert(test) );
==================================================================
So simple and still it took me about 2 hours to find out.....

Anyway, thnks for the reply.

Bart

NB AFAIK something is inserted BEFORE.

On Thu, 2003-11-13 at 15:02, Murray Cumming Comneon com wrote:
> > 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]