Hello! I’m trying to use gtk-3, gtkmm, ande glade, to create a ComboBoxText element, whose items can change over time. For background, I’m trying up upgrade this timecard program–it’s a simple timesheet/timecard application, and I want to add an ability to select between multiple tasks via a new ComboBoxText element. I want this element to 1) show which task is currently active, 2) list tasks in order of which was most recently used, and 3) be able to add tasks if the user informs the application of a new timecard file on the system. For this, I’m trying to walk through the current list of entries to the combobox (project/task names), find the currently selected entry, remove it if it isn’t the first entry, and then move it to the first entry.
As far as I can tell, to do this I need to get a hold of the underlying ListStore model used by the ComboBoxText element, get an iterator to that model, walk through the model’s children, find the element that needs to be removed, and then call the erase() function on it. The TreeStore element is apparently not suffiient, since it doesn’t offer any erase() functionality.
At present, I’m struggling to figure out how to get a pointer to the ListStore model found within the ComboBoxText. My most recent attempt was something like:
where m_taskchoice is a pointer to my Gtk::ComboBoxText element … but this doesn’t seem to be working at all. It looks like I might be able to call something like GTK_LIST_STORE(m_taskchoice->get_model()) on the model, except that seems to be a Gtk only feature, and I can’t seem to find a gtkmm analog for it.