How do I select the last added item in a treeview?...
# tornadofx
m
How do I select the last added item in a treeview? The items are added into the items property.
I'm using this in `cellFormat`:
Copy code
treeItem.children.onChange { change ->
    while(change.next()) {
        change.addedSubList.lastOrNull()?.let {
            selectionModel.select(it)
        }
    }
}
I'm almost sure this will cause oversubscription. Moreover, I will have problems when I'll create a treeview and bind it to a non-empty list, because a node will be selected at startup.