From ccf8095516c7cfae68f2ad612bcdb1e2d6420786 Mon Sep 17 00:00:00 2001 From: Robert Jaros Date: Thu, 8 Mar 2018 08:38:32 +0100 Subject: Adds a property to activate child component directly. --- src/main/kotlin/pl/treksoft/kvision/panel/StackPanel.kt | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'src/main/kotlin/pl') diff --git a/src/main/kotlin/pl/treksoft/kvision/panel/StackPanel.kt b/src/main/kotlin/pl/treksoft/kvision/panel/StackPanel.kt index da41db9f..3b045fa6 100644 --- a/src/main/kotlin/pl/treksoft/kvision/panel/StackPanel.kt +++ b/src/main/kotlin/pl/treksoft/kvision/panel/StackPanel.kt @@ -46,6 +46,15 @@ open class StackPanel( */ var activeIndex by refreshOnUpdate(-1) + /** + * The active (visible) child. + */ + var activeChild + get() = children[activeIndex] + set(value) { + activeIndex = children.indexOf(value) + } + init { @Suppress("LeakingThis") init?.invoke(this) -- cgit