Re: [gtkmm] iterating through the contents of a tree



Murray Cumming Comneon com wrote:


OK, so use Gtk::TreeView::get_selection() and then
Gtk::TreeSelection::get_selected_rows() as I described in a similar thread
today.
marvellous. i've got something that works, though i strongly suspect it's not the cleanest way to do it:


 Glib::RefPtr<Gtk::TreeSelection> sel = mw_tree_view.get_selection();
 list<Gtk::TreeModel::Path> listPaths = sel->get_selected_rows();

 list<Gtk::TreeModel::Path>::iterator it;
 for (it=listPaths.begin(); it != listPaths.end(); ++it) {

   Gtk::TreeModel::Path path = *it;
   Gtk::TreeModel::iterator qwe = m_refTreeModel->get_iter(path);
   Gtk::TreeModel::Row row = *qwe;
   string dir = row[mc_columns.m_path_name];

 }



bevis





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