From eea44b35add0d036119888f41e4ed38e75190934 Mon Sep 17 00:00:00 2001 From: Robert Jaros Date: Mon, 12 Feb 2018 12:00:15 +0100 Subject: DSL builders returning built components. --- src/main/kotlin/pl/treksoft/kvision/dropdown/DropDown.kt | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'src/main/kotlin/pl/treksoft/kvision/dropdown') diff --git a/src/main/kotlin/pl/treksoft/kvision/dropdown/DropDown.kt b/src/main/kotlin/pl/treksoft/kvision/dropdown/DropDown.kt index 1af71dc8..0f653d30 100644 --- a/src/main/kotlin/pl/treksoft/kvision/dropdown/DropDown.kt +++ b/src/main/kotlin/pl/treksoft/kvision/dropdown/DropDown.kt @@ -239,7 +239,7 @@ open class DropDown( internal var counter = 0 /** - * DSL builder extension function + * DSL builder extension function. * * It takes the same parameters as the constructor of the built component. */ @@ -247,8 +247,10 @@ open class DropDown( text: String, elements: List? = null, icon: String? = null, style: BUTTONSTYLE = BUTTONSTYLE.DEFAULT, disabled: Boolean = false, classes: Set = setOf(), init: (DropDown.() -> Unit)? = null - ) { - this.add(DropDown(text, elements, icon, style, disabled, classes).apply { init?.invoke(this) }) + ): DropDown { + val dropDown = DropDown(text, elements, icon, style, disabled, classes).apply { init?.invoke(this) } + this.add(dropDown) + return dropDown } } } -- cgit