Reputation: 1371
I have a treeView with two columns. I've this method which is supposed to be call when a row is selected :
private Aircraft get_selected_aircraft () {
}
It will return an Aircraft from the registration of the first column. But how to get this registration? I have a TreeSelection
and I can use get_selected_rows ()
but even with this I still don't know how to do...
Upvotes: 0
Views: 4092
Reputation: 1072
Connect to the changed signal on the TreeSelection.
It also sounds like you probably want to make sure the selection is in GTK_SELECTION_SINGLE mode (either done in Glade or by calling set_mode() on your TreeSelection.
Upvotes: 1
Reputation: 14873
Here are some examples:
https://wiki.gnome.org/Projects/Vala/GTKSample (in the "TreeView with ListStore" section)
https://srackham.wordpress.com/2010/09/13/vala-treeview-list-example/
Depending on the kind of store you are using as your TreeModel, you should read the TreeStore and / or ListStore documentation.
The key method of getting values is TreeModel.get ().
Upvotes: -1