Re: How to access list within a GTK::TreeView ? [SOLVED]



On Sun, 2008-06-15 at 11:16 -0600, Dave Bartmess wrote:
> On Saturday 14 June 2008 10:31:51 pm Dave Bartmess wrote:
> > I'm using a Gtk::ListStore for the model of a Gtk::TreeView, and want to
> > get an iterator or list of the contents of the rows. I don't see any way to
> > get an iterator OR the contents of the TreeView for use after the editing
> > is done.
> >
> > How do I do that? I see get_iter(Path &), but I'm not sure what path to
> > use...
> >
> > Kinda new to GTKMM, so please be kind...
> 
> I finally figured it out... As the code below shows, I need to get the 
> children (NOT a very understandable name... btw). Hope this helps someone 
> else avoid this problem....
> 
> void MainWindow::on_button_save() {
>     cout << "Button Save" << endl;
>     Gtk::TreeModel::iterator iter = refListStore->children().begin();
>     for (; iter != refListStore->children().end(); ++iter) {
>         cout << (*iter)[m_Columns.m_title] << endl;
>     }
>     setChanged(false);
> }

We do have a whole chapter about the TreeView that covers this basic
stuff, by the way. For instance:
http://www.gtkmm.org/docs/gtkmm-2.4/docs/tutorial/html/sec-iterating-over-model-rows.html


-- 
murrayc murrayc com
www.murrayc.com
www.openismus.com



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