aboutsummaryrefslogtreecommitdiff
path: root/src/main/kotlin/pl
diff options
context:
space:
mode:
authorRobert Jaros <rjaros@finn.pl>2018-03-08 08:38:32 +0100
committerRobert Jaros <rjaros@finn.pl>2018-03-08 08:38:32 +0100
commitccf8095516c7cfae68f2ad612bcdb1e2d6420786 (patch)
treeabf779caae515d328984d903000406d7590f9b9f /src/main/kotlin/pl
parent457c34a66170b1b5d395bff24297958902a81de7 (diff)
downloadkvision-ccf8095516c7cfae68f2ad612bcdb1e2d6420786.tar.gz
kvision-ccf8095516c7cfae68f2ad612bcdb1e2d6420786.tar.bz2
kvision-ccf8095516c7cfae68f2ad612bcdb1e2d6420786.zip
Adds a property to activate child component directly.
Diffstat (limited to 'src/main/kotlin/pl')
-rw-r--r--src/main/kotlin/pl/treksoft/kvision/panel/StackPanel.kt9
1 files changed, 9 insertions, 0 deletions
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)