kasrasadeghi
06/06/2017, 8:21 PMkasrasadeghi
06/06/2017, 8:21 PMclass GraphView : View("My View") {
override val root = group {
rectangle {
fill = Color.BLUE
width = 100.0
height = 100.0
}
}
}
kasrasadeghi
06/06/2017, 8:22 PMclass MainView : View("Hello TornadoFX Application") {
override val root = stackpane {
GraphView()
}
}
kasrasadeghi
06/06/2017, 8:22 PMkasrasadeghi
06/06/2017, 8:23 PMkasrasadeghi
06/06/2017, 8:23 PMclass MainView : View("Hello TornadoFX Application") {
override val root = stackpane {
group {
rectangle {
fill = Color.BLUE
width = 100.0
height = 100.0
}
}
}
}
kasrasadeghi
06/06/2017, 8:23 PMnimakro
06/06/2017, 8:27 PMclass MainView : View("Hello TornadoFX Application") {
override val root = stackpane {
add(GraphView::class)
}
}
kasrasadeghi
06/06/2017, 8:31 PMkasrasadeghi
06/06/2017, 8:31 PMnimakro
06/06/2017, 8:31 PMnimakro
06/06/2017, 8:32 PMRuckus
06/06/2017, 8:32 PMGraphView()
is just calling the constructor of your GraphView
class. It's not part of the TornadoFX DSLnimakro
06/06/2017, 8:32 PMgroup
builder is adding itself to the stackpanekasrasadeghi
06/06/2017, 8:33 PMnimakro
06/06/2017, 8:34 PMGraphView
is only calling the constructor and the add()
is actually adding itkasrasadeghi
06/06/2017, 8:35 PMRuckus
06/06/2017, 8:36 PMGraphView()
is just the constructor for your class, whereas group()
is a function defined in TornadoFX. If you used the constructor Group()
you'd have to add it yourself as well. The DSL functions defined in TornadoFX take care of creating the object, adding it to the parent, and appending a scoped function to continue the DSL awesomeness.Ruckus
06/06/2017, 8:36 PMRuckus
06/06/2017, 8:37 PMRuckus
06/06/2017, 8:38 PMkasrasadeghi
06/06/2017, 8:38 PMedvin
06/06/2017, 9:16 PMcarlw
06/06/2017, 9:17 PMnimakro
06/06/2017, 9:18 PMcarlw
06/06/2017, 9:19 PMedvin
06/06/2017, 9:19 PMedvin
06/06/2017, 9:20 PMnimakro
06/06/2017, 9:22 PMedvin
06/06/2017, 9:22 PM