Positioning of the slider by just a single click
3 views (last 30 days)
Show older comments
Dear all,
I am using sliders in a GUI as visual analogue scales for perceptual experimentation.
One question regarding the positioning of the slider: One can control the slidersteps (small and large ones) easily by controlling the SliderStep property of the slider. Would it also be possible to immediately position the slider at any position with just one click at any position in the area of the slidebar, instead of triggering large steps when clicking in that area?
Thanks a lot
Best, Philipp
0 Comments
Answers (1)
Jan
on 21 Nov 2018
This is not the standard behavior of sliders and as usual, implementing an unexpected behavior of a GUI element will confuse the users. Therefore I recommend not to try it.
You can check the current position of the mouse in the slider's callback, and if you detect a click on the bar, you can adjust the slider's 'Value' property such, that it equals the position of the mouse. This is not hard, but a little bit tedious: Maybe you have to get the position of the slider dynamically, what it has 'normalized' units and the figure is resizable. But there is always a method to get the slider's and mouse' position in pixels, such that implementing an individual method for moving the slider is possible. Try it and post the current code in case of problems.
0 Comments
See Also
Categories
Find more on Migrate GUIDE Apps in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!