From fc373ac45baf37fa2d6d5be7c4308eec7c5c6111 Mon Sep 17 00:00:00 2001 From: georgweiss Date: Tue, 15 Feb 2022 15:42:13 +0100 Subject: [PATCH] Bug fix in spinner widget --- .../javafx/widgets/SpinnerRepresentation.java | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/app/display/representation-javafx/src/main/java/org/csstudio/display/builder/representation/javafx/widgets/SpinnerRepresentation.java b/app/display/representation-javafx/src/main/java/org/csstudio/display/builder/representation/javafx/widgets/SpinnerRepresentation.java index f9d064facb..7c431eaa42 100644 --- a/app/display/representation-javafx/src/main/java/org/csstudio/display/builder/representation/javafx/widgets/SpinnerRepresentation.java +++ b/app/display/representation-javafx/src/main/java/org/csstudio/display/builder/representation/javafx/widgets/SpinnerRepresentation.java @@ -65,6 +65,7 @@ public class SpinnerRepresentation extends RegionBaseRepresentation createJFXNode() throws Exception { final Spinner spinner = new Spinner<>(); + spinner.setValueFactory(createSVF()); spinner.focusedProperty().addListener((property, oldval, newval)-> { @@ -72,6 +73,7 @@ protected final Spinner createJFXNode() throws Exception restore(); active = false; }); + spinner.getEditor().setOnKeyPressed((final KeyEvent event) -> { switch (event.getCode()) @@ -280,6 +282,11 @@ public String getName() return "vtypeValue"; } + @Override + public String toString(){ + return get().toString(); + } + }; public final void setVTypeValue(VType value) { @@ -298,15 +305,21 @@ public final VType getVTypeValue() @Override public void decrement(int steps) { - if (!toolkit.isEditMode() && model_widget.propEnabled().getValue()) + if (!toolkit.isEditMode() && model_widget.propEnabled().getValue()){ + active = false; writeResultingValue(-steps*getStepIncrement()); + } + } @Override public void increment(int steps) { - if (!toolkit.isEditMode() && model_widget.propEnabled().getValue()) + if (!toolkit.isEditMode() && model_widget.propEnabled().getValue()){ + active = false; writeResultingValue(steps*getStepIncrement()); + } + } private void writeResultingValue(double change)