From e8fb55f9e63e8d1a3105c8f72b1056ea2ad363dd Mon Sep 17 00:00:00 2001 From: wmliu Date: Fri, 7 Nov 2025 13:44:46 -0600 Subject: [PATCH 1/4] Modified the behavior of spinner widget to react differently with different key combinations arrow up/down: change by 1 increment page up/down: change by 10 increment Alt + arrow up/down change by 5 increment Alt + page up/down change by 50 increment --- .../javafx/widgets/SpinnerRepresentation.java | 42 +++++++++++++++++-- 1 file changed, 38 insertions(+), 4 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 f8ee0881db..931379c21a 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 @@ -105,16 +105,50 @@ else if(focused){ } break; //incrementing by keyboard + //isShiftDown(), isControlDown(), isAltDown(), and isMetaDown() case UP: + if (!active) { + if(event.isAltDown()) { + spinner.getValueFactory().increment(5); + } + else { + spinner.getValueFactory().increment(1); + } + } + break; case PAGE_UP: - if (!active) - spinner.getValueFactory().increment(1); + if (!active) { + if(event.isAltDown()) { + spinner.getValueFactory().increment(50); + } + else { + spinner.getValueFactory().increment(10); + } + } break; case DOWN: + if (!active) { + if(event.isAltDown()) { + spinner.getValueFactory().decrement(5); + } + else { + spinner.getValueFactory().decrement(1); + } + } + break; case PAGE_DOWN: - if (!active) - spinner.getValueFactory().decrement(1); + if (!active) { + if(event.isAltDown()) { + spinner.getValueFactory().decrement(50); + } + else { + spinner.getValueFactory().decrement(10); + } + } break; + case ALT: + setActive(false); + break; default: // Any other key results in active state setActive(true); From 3969688f27029e68115b84b0eca076595b070f62 Mon Sep 17 00:00:00 2001 From: wmliu Date: Thu, 18 Dec 2025 18:57:26 -0600 Subject: [PATCH 2/4] Modified the behavior of spinner widget to make 5x steps, 10x steps increments with key combination ctrl+ up/down(5x); ctrl + page up/page down(10x); ctrl + left/right (10x) --- .../controls_spinner_slider_scrollbar.bob | 25 ++++++++--------- .../javafx/widgets/SpinnerRepresentation.java | 28 +++++++++++++------ 2 files changed, 30 insertions(+), 23 deletions(-) diff --git a/app/display/model/src/main/resources/examples/controls_spinner_slider_scrollbar.bob b/app/display/model/src/main/resources/examples/controls_spinner_slider_scrollbar.bob index cc34519523..e104788862 100644 --- a/app/display/model/src/main/resources/examples/controls_spinner_slider_scrollbar.bob +++ b/app/display/model/src/main/resources/examples/controls_spinner_slider_scrollbar.bob @@ -1,5 +1,5 @@ - + Spinner Slider Scrollbar Scrollbar @@ -45,7 +45,6 @@ 110 220 false - #.## Label_3 @@ -70,18 +69,17 @@ Label_5 - The value can be adjusted both with -the mouse and, when the widget is in -focus, using the arrow keys and -page up/down keys. + The value can be adjusted both with the mouse and, when the widget is in focus, using the arrow keys and page up/down keys. + Up/Down arrow keys and Page Up/Down keys will change the value by 1 step size + Ctrl + Up/Down arrow keys will change the value by 5 x step size + Ctrl + Page Up/Down keys will change the value by 10 x step size + To make it up for some keyboard that need Fn keys to activate Page Up/Down, one can also use Ctrl Left/Right arrow keys to make changes at 10 x step szie -The "increment" property of the widget -determines the step size when using -the keyboard. - 143 - 191 - 238 - 189 +The "increment" property of the widget determines the step size when using the keyboard. + 141 + 160 + 579 + 250 Scaled Slider_1 @@ -90,7 +88,6 @@ the keyboard. 429 419 61 - #.## false 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 931379c21a..a4592ed0f5 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 @@ -106,9 +106,19 @@ else if(focused){ break; //incrementing by keyboard //isShiftDown(), isControlDown(), isAltDown(), and isMetaDown() + case LEFT: + if(event.isControlDown()) { + spinner.getValueFactory().increment(10); + } + break; + case RIGHT: + if(event.isControlDown()) { + spinner.getValueFactory().decrement(10); + } + break; case UP: if (!active) { - if(event.isAltDown()) { + if(event.isControlDown()) { spinner.getValueFactory().increment(5); } else { @@ -118,17 +128,17 @@ else if(focused){ break; case PAGE_UP: if (!active) { - if(event.isAltDown()) { - spinner.getValueFactory().increment(50); + if(event.isControlDown()) { + spinner.getValueFactory().increment(10); } else { - spinner.getValueFactory().increment(10); + spinner.getValueFactory().increment(1); } } break; case DOWN: if (!active) { - if(event.isAltDown()) { + if(event.isControlDown()) { spinner.getValueFactory().decrement(5); } else { @@ -138,15 +148,15 @@ else if(focused){ break; case PAGE_DOWN: if (!active) { - if(event.isAltDown()) { - spinner.getValueFactory().decrement(50); + if(event.isControlDown()) { + spinner.getValueFactory().decrement(10); } else { - spinner.getValueFactory().decrement(10); + spinner.getValueFactory().decrement(1); } } break; - case ALT: + case CONTROL: setActive(false); break; default: From 6e1f01334955e8579bb1835f9cca40c0486e0ec6 Mon Sep 17 00:00:00 2001 From: wmliuanl <78451125+wmliuanl@users.noreply.github.com> Date: Fri, 19 Dec 2025 09:19:46 -0600 Subject: [PATCH 3/4] Update controls_spinner_slider_scrollbar.bob Change key combinations to remove ctrl + page up/down, because it behaves differently on two different system. --- .../resources/examples/controls_spinner_slider_scrollbar.bob | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/app/display/model/src/main/resources/examples/controls_spinner_slider_scrollbar.bob b/app/display/model/src/main/resources/examples/controls_spinner_slider_scrollbar.bob index e104788862..f3fe26358b 100644 --- a/app/display/model/src/main/resources/examples/controls_spinner_slider_scrollbar.bob +++ b/app/display/model/src/main/resources/examples/controls_spinner_slider_scrollbar.bob @@ -72,8 +72,7 @@ The value can be adjusted both with the mouse and, when the widget is in focus, using the arrow keys and page up/down keys. Up/Down arrow keys and Page Up/Down keys will change the value by 1 step size Ctrl + Up/Down arrow keys will change the value by 5 x step size - Ctrl + Page Up/Down keys will change the value by 10 x step size - To make it up for some keyboard that need Fn keys to activate Page Up/Down, one can also use Ctrl Left/Right arrow keys to make changes at 10 x step szie + Ctrl + Left/Right arrow keys to make changes at 10 x step szie The "increment" property of the widget determines the step size when using the keyboard. 141 From 471890f06df6846c993617088e78d904fbd1d1a3 Mon Sep 17 00:00:00 2001 From: wmliuanl <78451125+wmliuanl@users.noreply.github.com> Date: Fri, 19 Dec 2025 10:13:05 -0600 Subject: [PATCH 4/4] Update SpinnerRepresentation.java Remove the key combination of ctrl + page up/page down which doesn't actually work on a test system --- .../javafx/widgets/SpinnerRepresentation.java | 15 +++------------ 1 file changed, 3 insertions(+), 12 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 a4592ed0f5..aad488ca8c 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 @@ -128,12 +128,7 @@ else if(focused){ break; case PAGE_UP: if (!active) { - if(event.isControlDown()) { - spinner.getValueFactory().increment(10); - } - else { - spinner.getValueFactory().increment(1); - } + spinner.getValueFactory().increment(1); } break; case DOWN: @@ -148,12 +143,7 @@ else if(focused){ break; case PAGE_DOWN: if (!active) { - if(event.isControlDown()) { - spinner.getValueFactory().decrement(10); - } - else { - spinner.getValueFactory().decrement(1); - } + spinner.getValueFactory().decrement(1); } break; case CONTROL: @@ -652,3 +642,4 @@ private void setActive(final boolean active) updateChanges(); } } +