Re: [gtkmm] Using TreeView/ListStore



Gooble gooble wrote:

In a TreeModel/List store when a row is clicked
(on_row_activated) how do I get access to the row ?
The on_row_activated function has a TreeModel::Path
argument and a TreeViewColumn argument. It is not
clear to me how I can get access to the row elements
using either of these vars.
Gtk::TreeModel::iterator iter = TreeModel->get_iter(path);
row = *iter;

Having a row you can obtain data from any cell on that row:
Glib::ustring s;
int x;
s = row[TreeModel.any_string_column];
x = row[TreeModel.any_int_column];

Here is how you can get the column number:
int column_number = 0;
while (column != YourTree->get_column(column_number))
       column_number++;

And so on...
   Igor Gorbounov




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