https://kotlinlang.org logo
#tornadofx
Title
# tornadofx
m

melatonina

09/05/2020, 10:08 AM
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.
9 Views