Positioning of the slider by just a single click

3 Ansichten (letzte 30 Tage)
Philipp
Philipp am 21 Nov. 2018
Beantwortet: Jan am 21 Nov. 2018
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

Antworten (1)

Jan
Jan am 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.

Kategorien

Mehr zu Migrate GUIDE Apps finden Sie in Help Center und File Exchange

Produkte


Version

R2016b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by