poohbar
02/22/2018, 2:34 PMvbox {
button {
action {
// call a method that adds another button to vbox
}
}
}
I guess I could pass a reference to the vbox this@vbox
to the method and then use add(...)
but I guess there is a more idiomatic way?Carlton Whitehead
02/22/2018, 6:16 PMlateinit var theVbox: VBox
vbox {
theVbox = this
button("Original") {
action { performAdd() }
}
}
fun performAdd() {
theVbox.add(Button("another"))
}
That would cut down the arguments needed in the method signature, and would still work if the original button needed to be moved out of the same vbox as where the new children gopoohbar
02/22/2018, 8:43 PM