Hi, I am trying to create a UI with TornadoFX but ...
# tornadofx
p
Hi, I am trying to create a UI with TornadoFX but got some trouble in using embedded views with hbox. Maybe I am missing something? Because shows up:
Copy code
class MasterView : View() {
    override val root = hbox {
        RouteView()
    }
}

class RouteView : View() {
    override val root = vbox {
        label("Routes Folder")
        combobox<String> {

        }
        listview<String> {
        }
        button {
            text = "Check Route"
        }
    }
}
However, if I put the RouteView code directly inside the MasterView hbox it works without problem - or if I use another layout like borderpane/vbox. Does hbox require something special?
b
add(RouteView::class)
p
Darn, that simple. Does this work for all layouts?
b
Or using
Copy code
val view: View by inject()
root = vbox { 
    add(view)
}
p
Thank you, that worked.
b
@Pawnee yes
r
If you want to use the
add
version, you can use the reified variant
add<RouteView>()
, but I prefer the
inject
version.