Re: changing the content of a model/view/store at run time



From the Gtk::TreeModel reference: "This class defines a generic tree interface for use by the Gtk::TreeView widget. ... It is important to note that *this interface only provides a way of examining a model and observing changes. The implementation of each individual model decides how and if changes are made.*"

Have a look at Gtk::TreeStore and Gtk::ListStore, which are implementations based on Gtk::TreeModel. One or the other will likely provide the functionality you're looking for.

On 8/8/19 2:46 PM, pcr wrote:

I'm trying to learn how to iterate over model rows in a manner similar to the code segment in section 9.3 of the gnome gtkmm tutorial.  Consider me a newbie; the "something" I want to do below is delete/clear/erase a row - really all rows so I can display a new set of rows in response to a user action like changing a radio button.  But I haven't been able to do it. Here is the snippit from section 9.3:

typedef Gtk::TreeModel::Children type_children; //minimise code length.
type_children children = refModel->children();
for(type_children::iterator iter = children.begin();
     iter != children.end(); ++iter)
{
   Gtk::TreeModel::Row row = *iter;
   //Do something with the row - see above for set/get.
}

*I'm also confused by the following comment I found on line; I don't see how this can work with the above code either. ***
iterator Gtk::TreeStore:erase(const iterator& iter)
        Returns an iterator to the next row or end() if there is none"
Note that this refers to Gtk:TreeStore, not Gtk::TreeModel.
I hope you can help me .  Thanks, PCR


_______________________________________________
gtkmm-list mailing list
gtkmm-list gnome org
https://mail.gnome.org/mailman/listinfo/gtkmm-list


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