aboutsummaryrefslogtreecommitdiff
path: root/src/main/kotlin/pl/treksoft/kvision/panel
diff options
context:
space:
mode:
authorRobert Jaros <rjaros@finn.pl>2017-09-30 12:50:04 +0200
committerRobert Jaros <rjaros@finn.pl>2017-09-30 12:50:04 +0200
commitef4d83ee13289761a014f884ee83688038e7b497 (patch)
tree7cf00eba1327898660584285c814aef4226c3ae7 /src/main/kotlin/pl/treksoft/kvision/panel
parent4a62542e4dcc47c337885c74704500b67c15d02d (diff)
downloadkvision-ef4d83ee13289761a014f884ee83688038e7b497.tar.gz
kvision-ef4d83ee13289761a014f884ee83688038e7b497.tar.bz2
kvision-ef4d83ee13289761a014f884ee83688038e7b497.zip
Unit tests
Diffstat (limited to 'src/main/kotlin/pl/treksoft/kvision/panel')
-rw-r--r--src/main/kotlin/pl/treksoft/kvision/panel/StackPanel.kt2
1 files changed, 2 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 24429d42..372098b8 100644
--- a/src/main/kotlin/pl/treksoft/kvision/panel/StackPanel.kt
+++ b/src/main/kotlin/pl/treksoft/kvision/panel/StackPanel.kt
@@ -23,12 +23,14 @@ open class StackPanel(private val activateLast: Boolean = true,
override fun add(child: Widget): Container {
super.add(child)
if (activateLast) activeIndex = children.size - 1
+ else if (activeIndex == -1) activeIndex = 0
return this
}
override fun addAll(children: List<Widget>): Container {
super.addAll(children)
if (activateLast) activeIndex = this.children.size - 1
+ else if (activeIndex == -1) activeIndex = 0
return this
}