RE: [gtkmm] remove all children of a Gtk::Container



If nobody points out an error in your code then please do attach this to a
bugzilla bug.

Murray Cumming
murrayc usa net
www.murrayc.com 

> -----Original Message-----
> From: erwan ancel [mailto:erwan ancel free fr] 
> Sent: Freitag, 4. April 2003 19:29
> To: gtkmm-list gnome org
> Subject: Re: [gtkmm] remove all children of a Gtk::Container
> 
> 
> Ok. It doesn't work... Here is a sample code: I just add some 
> entries in the
> list of a combo box, and then remove them: segmentation fault ...
> Dos anyone have an idea ?
> nb: I use derived objects of Gtk::ComboDropDownItem as items. 
> But it should
> not disturb, should it?
> 
>     Erwan
> 
> here is the sample code:
> 
> 
> #include <gtkmm/main.h>
> #include <gtkmm/window.h>
> #include <gtkmm/combo.h>
> 
> #include <list>
> 
> class SampleWindow: public Gtk::Window
> {
> public:
>     SampleWindow()
>     {
>         add(_combo);
>         for (int i=1; i<=10; ++i)
>         {
>             char buff[100];
>             sprintf(buff, "entry number %d", i);
>             _combo.get_list()->children().push_back(*Gtk::manage(new
> ComboItem(buff)));
>         }
>         _combo.get_list()->children().clear();
>         show_all_children();
>     }
> 
> private:
>     Gtk::Combo _combo;
>     class ComboItem: public Gtk::ComboDropDownItem
>     {
>     public:
>         ComboItem(const char* s):
>             _label(s)
>         {
>             add(_label);
>             show_all();
>         }
>         Gtk::Label _label;
>     };
> };
> 
> 
> int main(int argc, char *argv[])
> {
>     Gtk::Main kit(argc, argv);
>     SampleWindow sw;
>     Gtk::Main::run(sw);
>     return 0;
> }
> 
> 
> _______________________________________________
> gtkmm-list mailing list
> gtkmm-list gnome org
> http://mail.gnome.org/mailman/listinfo/gtkmm-list
> 



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