From 967f979dfcb1010727d2af07e17f4ed6bf621a04 Mon Sep 17 00:00:00 2001 From: halotukozak Date: Tue, 23 Jan 2024 18:21:42 +0100 Subject: [PATCH] add binding from flow to input --- src/main/kotlin/frontend/components/View.kt | 6 ++++++ src/main/kotlin/frontend/config/ConfigView.kt | 3 +++ 2 files changed, 9 insertions(+) diff --git a/src/main/kotlin/frontend/components/View.kt b/src/main/kotlin/frontend/components/View.kt index 1f5f0ee..52c51b8 100644 --- a/src/main/kotlin/frontend/components/View.kt +++ b/src/main/kotlin/frontend/components/View.kt @@ -113,6 +113,9 @@ abstract class View( tooltip(ConfigField.description()) toggleSwitch { isSelected = property.value + property.onUpdate { + isSelected = it + } selectedProperty().addListener { _, _, newValue -> property.update { newValue } } @@ -126,6 +129,9 @@ abstract class View( tooltip(ConfigField.description()) val values = enumEntries() combobox(SimpleObjectProperty(values.first()), values) { + property.onUpdate { + value = it + } valueProperty().addListener { _ -> property.update { value } } diff --git a/src/main/kotlin/frontend/config/ConfigView.kt b/src/main/kotlin/frontend/config/ConfigView.kt index 8a3402f..75b909e 100644 --- a/src/main/kotlin/frontend/config/ConfigView.kt +++ b/src/main/kotlin/frontend/config/ConfigView.kt @@ -139,6 +139,9 @@ class ConfigView : View("Config editor") { tooltip(ConfigField.description()) val left = textfield(seed.value.toString()) { + seed.onUpdate { + text = it?.toString() ?: "" + } textProperty().addListener { _ -> decorators.forEach { it.undecorate(this) } decorators.clear()