Louis Etienne
Louis Etienne

Reputation: 1371

How to get the selected row from a TreeView

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

Answers (2)

TheAmigo
TheAmigo

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

Jens Mühlenhoff
Jens Mühlenhoff

Reputation: 14873

Here are some examples:

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

Related Questions