Arley Consuegra Rosello wrote:
> Hello again.
> I'm testing the GtkTreeView with GtkTreeStore but don't find in the doc how
> to get value of an selected row.
> With Gtkmm I found an example in
> http://git.gnome.org/browse/gtkmm-documentation/tree/examples/book/treeview/tree/examplewindow.cc
>
> void ExampleWindow::on_treeview_row_activated(const Gtk::TreeModel::Path&
> path,
> Gtk::TreeViewColumn* /* column */)
> {
> Gtk::TreeModel::iterator iter = m_refTreeModel->get_iter(path);
> if(iter)
> {
> Gtk::TreeModel::Row row = *iter;
> std::cout << "Row activated: ID=" << row[m_Columns.m_col_id] << ", Name="
> << row[m_Columns.m_col_name] << std::endl;
> }
> }
I think it translates to something like this:
---------------------------------------------------------------------------------------
enum Columns { ID, NAME, N_COLUMNS }
void on_treeview_row_activated (TreeView view, TreePath path, TreeViewColumn
column) {
TreeIter iter;
bool valid = view.model.get_iter (out iter, path);
if (valid) {
int id;
string name;
view.model.get (iter, Columns.ID, out id, Columns.NAME, out
name, -1);
stdout.printf ("Row activated: ID=%d, Name=%s\n", id, name);
}
}
---------------------------------------------------------------------------------------
Best regards,
Frederik
_______________________________________________
Vala-list mailing list
[email protected]
http://mail.gnome.org/mailman/listinfo/vala-list