[prev in list] [next in list] [prev in thread] [next in thread] 

List:       gtkmm
Subject:    RE: [gtkmm] Boxlist iteration
From:       Tobias Peters <tpeters () uni-oldenburg ! de>
Date:       2001-08-14 4:42:02
[Download RAW message or body]

> Taybin Rutkin wrote:
> >
> > Could someone give me an example of how to iterate over a boxlist?
I'm
> > getting stuck.  Here's what I already have:
> > 
> > Gtk::Box_Helpers::BoxList blist = packer.children();
> > list<Gtk::Widget>::iterator i;
> >  
> > i = blist.begin();
> > i++;    /* Skip combo/button box */
> > while(i != blist.end()){
> >         delete (*i);
> >         i++;
> > }
> >
> > I want to skip the first box in the list, but delete all the others.
If
> > anyone knows an easier way to do that, I'd like to hear it.

Don't you have to use

Gtk::Box_Helpers::BoxList::iterator i;
    
for the i declaraction?
And, from what I see in <gtk--/box.h>, *i is not a pointer, but a
reference to an object of class Gtk::Box_Helpers::Child, so you should not
try to delete it.

How about

i = blist.begin();
i++;    /* Skip combo/button box */
blist.erase(i, blist.end());

for the rest? If all your contained widgets are managed, I think it should
work.
   
Tobias


_______________________________________________
to unsubscribe or change your subscription parameters :
http://lists.sourceforge.net/lists/listinfo/gtkmm-main

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic