[gtkmm] Gtk::Combo get_list()->children().clear() howto?



I am using a combo box as a search entry. As the user types into the combo box, a database lookup happens, and the top match is displayed in the entry. If the user clicks on the drop-down button, a list of matching entries is displayed. Just like your mozilla browser does when you type on the address line.

I can populate the combo box on the first search, but CANNOT figure out how to delete and repopulate the combo box on subsequent searches.

I have tried:

	combo->get_list()->children().clear();

but this crashes. It's not clear to me that this is a bug, or I don't know how to program it correctly. The debugger says:

Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 1086466976 (LWP 15014)]
0x4012322f in Gtk::ComboDropDown_Helpers::ComboDropDownList::erase(Glib::List_Iterator<Gtk::ComboDropDownItem>) (this=0x827f2b8, position={<List_Iterator_Base<Gtk::ComboDropDownItem>> = {<No data fields>}, head_ = 0x829c804, node_ = 0x82a4e9c}) at combo.h:105 in combo.h

How do you manage (delete and add) the items in a dynamic combo box like this? Is it possible? Certainly someone out there does this.

I have read the list archives and discovered that MANY people have had this problem in the past, but I cannot find any message that posts a solution, workaround or an example. All of the examples that I can find for Gtk::Combo are static combo boxes.

It would be nice if one could simply myCombo->clear(); and get a fresh empty combo box to repopulate, but I cannot make this happen. Any help would be great!

If and when I get this working, I will update the combo example to show future gtkmm programmers how to do this.

Thanks,

Jeffrey S. Gavin




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