public static interface TreeView.RowActivated
Space
or Enter
are pressed while a
row is selected.
In general, you've got the TreeModel and especially its DataColumns
visible, so to use TreeView.RowActivated
you can just:
final TreeModel model; final DataColumnString column; view.connect(new TreeView.RowActivated() { public void onRowActivated(TreeView source, TreePath path, TreeViewColumn vertical) { final TreeIter row; row = model.getIter(path); ... = model.getValue(row, column); } });Remember that TreeIters and TreePaths are not stable over changes to the model, so get on with using
path
right away.
TreeView.RowActivated
is perfectly sufficient for basic
situations, but you may need to see TreeSelection's
TreeSelection.Changed
to for more complicated selection and
activation expressions. In practise you'll use both.
Modifier and Type | Method and Description |
---|---|
void |
onRowActivated(TreeView source,
TreePath path,
TreeViewColumn vertical)
The useful parameter is usually
path which can be
converted into a TreeIter with your TreeModel's
getIter() allowing you to then
lookup a particular value from the data model. |
void onRowActivated(TreeView source, TreePath path, TreeViewColumn vertical)
path
which can be
converted into a TreeIter with your TreeModel's
getIter()
allowing you to then
lookup a particular value from the data model. You rarely need
vertical
but it can give you some indication in which
column the click happened.