@edvin Regarding the cast, I'm trying to make the extension function mimic what's done in TornadoFX. For example, label{} is not an extension function of VBox or HBox, but rather the superclass "Builder".
This is the specific casting code that I'm copying...
fun EventTarget.getChildList(): MutableList<Node>? = when (this) {
is SplitPane -> items
is ToolBar -> items
is Pane -> children
is Group -> children
is HBox -> children
is VBox -> children
is Control -> if (skin is SkinBase<*>) (skin as SkinBase<*>).children else getChildrenReflectively()
is Parent -> getChildrenReflectively()
else -> null
}