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



well, that's a simple example, but I have to put a custom class in each
item.
But I made a test: it crashes exactly the same way when I use
Combo::set_popdown_strings().

----- Original Message -----
From: "Meier, Elke" <elke meier sysde eads net>
To: "'erwan ancel'" <erwan ancel free fr>; <gtkmm-list gnome org>
Sent: Monday, April 07, 2003 9:32 AM
Subject: AW: [gtkmm] remove all children of a Gtk::Container


Hi Erwan,

Why not just use Combo::set_popdown_strings() ?

  std::vector<Glib::ustring> tmpStrs;  // strings need to be utf8 encoded in
pango
  tmpStrs.push_back("");               // add all the strings you want
  _combo->set_popdown_strings(tmpStrs);

Why do you want to derive from Gtk::ComboDropDownItem ?

Elke

> -----Ursprüngliche Nachricht-----
> Von: erwan ancel [mailto:erwan ancel free fr]
> Gesendet: Freitag, 4. April 2003 19:29
> An: gtkmm-list gnome org
> Betreff: 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]