[gtkmm] Gtk::ComboDropDownList contains empty items



I'm sure I must be doing something wrong here, but if I create a
Gtk::Combo, add a couple of items to it, then attempt to iterate over
those items they appear to be 'blank' ComboDropDownItems, not the ones
inserted (although there are an equal number).

I'm using gobj() just because that seems to be the simplest case (I
was trying to use property_user_data() to store extra info, but an
assertion indicating the underlying gobj() is dodgy was stopping me
there.

Example code:

  Gtk::Window * win = new Gtk::Window();

  Gtk::Combo * combo = manage( new Gtk::Combo() );
  
  std::list<Glib::ustring> listStr;
  listStr.push_back("something");
  combo->set_popdown_strings(listStr);

  Gtk::ComboDropDownItem* item;
  item = Gtk::manage(new Gtk::ComboDropDownItem());
  item->add_label("something else");
  item->show_all();
  combo->get_list()->children().push_back(*item);

  win->add(*combo);

  Gtk::ComboDropDown_Helpers::ComboDropDownList& il =
  combo->get_list()->children();
  Gtk::ComboDropDown_Helpers::ComboDropDownList::iterator curr =
  il.begin();
  while (curr != il.end())
  {
    std::cout << curr->gobj() << std::endl; // always returns NULL ??
    ++curr;
  }
  
  win->show_all();

  app.run(*win);

  delete win;



Thanks,

Barnaby



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