Replies: 1 comment
-
It turns out, it is very hard to customize existing JavaFX slider functionality regarding the way that display position is translated to the slider value, which would be necessary for a logarithmic scale slider.
Regarding tick marks and labels: the If one could duplicate the code of Slider, SliderSkin and SliderBehaviour, NumberAxis, all the private places could be customized, but it would One alternative that works to some extent is to create a new control (e.g. a class derived from GridPane) that privately owns a Slider, and puts this "vanilla" Slider onto the UI. All Slider API that is being used from Phoebus code, can be forwarded to the internal Slider, except the value property. The new control creates an "outer" value property that translates to the value property of the privately owned Slider. This is enough to get a slider where the "thumb" position has the desired logarithmic correspondence to the slider |
Beta Was this translation helpful? Give feedback.
-
The classic Control System Studio used to have a slider with a "Log Scale" property which is presently lost when converting ".opi" documents to ".bob" for Phoebus. This variant of slider is useful if you need to control a parameter that ranges over many orders of magnitude. There is support for a logarithmic scale in read-only / display-only widgets such as the tank already.
The new Phoebus code seems to rely on JavaFX classes for slider implementation, and JavaFX does not offer a logarithmic scale. The JavaFX Slider model contains properties for the range, the current value, and a few others. Another boolean property for logarithmic scale (on/off) would need to be added. Then there is the SliderSkin which would need to implement the behaviour.
So the log scale property seems to have been primarily lost due to the change to JavaFX - not so much as an intentional decision.
One could argue that some server side logic can be put behind the slider that silently converts from linear to log-scale back and forth. However, this leads to a UI that shows some unintuitive quantity to the user that is the logarithm of the quantity that the user actually wants to set and this goes against what you try to do by offering a UI in the first place --- easily understandable controls that don't require the user to constantly calculate things in his head.
Have there been any considerations about whether a logarithmic-scale slider should be implemented and how to best realize this or is this rather regarded as a rarely used feature that does not deserve the added complexity in code?
I am interested in this, because I have used classic Control System Studio as a UI for a detector where the images can contain count rates that range from 0 to 10 million (but sometimes it's only 100 or 1000 counts) and a log-scale slider can be used to control the maximum of the intensity range that is mapped to white color on the grey scale of the displayed image.
Beta Was this translation helpful? Give feedback.
All reactions