Re: Gtk::TreeSelection::get_selected_rows()



Doug McLain wrote:

The gtkmm tutorial Treeview sections gives an example of getting multiple selections using the selected_foreach_iter() slot, but I want to try get_selected_rows(). I don't know how to use the return value though, ListHandle_Path. Could someone explain or show me a simple example?

Thanks
Doug

http://gtkmm.org/docs/gtkmm-2.4/docs/reference/html/classGtk_1_1TreeSelection.html#a7



If you're using multiple selection, you *must* use selected_foreach_iter(). The way I've used this, is just have a function that adds each selected iter its passed to a vector, then play with the iterators that are in the vector. Not very hard at all.

If you've got a single selection model, you can simplify this call.
For example:

Gtk::TreeModel::iterator iter = _exp_selection->get_selected() ;
Gtk::TreeModel::Row row = (*iter) ;

But remember, if you do have multiple selection enabled, get_selected() will *not* work.

Good luck,
Paul



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