Re: Gtk::TreeSelection::get_selected_rows()
- From: Doug McLain <dougmclain cayf org>
- To: Bob Caryl <bob fis-cal com>
- Cc: gtkmm <gtkmm-list gnome org>, paul linuxaudiosystems com
- Subject: Re: Gtk::TreeSelection::get_selected_rows()
- Date: Wed, 19 Oct 2005 12:43:29 -0400
I sort of combined both of your examples to get an error free build:
vector<Gtk::TreeModel::Path> pathlist =
redirect_display.get_selection()->get_selected_rows();
for (vector<Gtk::TreeModel::Path>::iterator iter = pathlist.begin();
iter != pathlist.end(); ++iter) {
TreeModel::Row row = *(model->get_iter (*iter));
redirects.push_back (row[columns.redirect]);
}
Doug
Bob Caryl wrote:
Hey Paul,
You are undoubtedly correct about my inefficiency; however, the reason
my example uses the std::vector<Gtk::TreeModel::Path> is because its use
is "chapter-and-verse" from the docs:
http://www.gtkmm.org/docs/gtkmm-2.4/docs/tutorial/html/ch03s05.html
I found this reference in the following post:
http://mail.gnome.org/archives/gtkmm-list/2004-November/msg00221.html
Bob
Paul Davis wrote:
// code snippet starts
// all this presupposes you've set up your tree view, a list or tree
store, and a tree view selection somewhere previously
std::vector<Gtk::TreeModel::Path> pathlist;
pathlist = myTreeViewSelection->get_selected_rows();
// Now, you have a list of paths to the selected rows. For each
entry in the list, you can get an iterator which can be deferenced to
a Gtk::TreeView::Row.
for(gint i = 0; i < pathlist.size(); i++)
{
Gtk::TreeModel::iterator iter =
myTreeView->get_model().get_iter(pathlist[i]);
Gtk::TreeModel::Row row = *iter;
--
http://nostar.net/
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]