aboutsummaryrefslogtreecommitdiff
path: root/src/main/kotlin/pl/treksoft/kvision/panel
diff options
context:
space:
mode:
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
}