When a user click the empty space (the sliding space) of the slider, the slider jumps. Although I have set 31 steps (by setting the slider step size), still there are only 3 jumps when mouse clicking on the empty spaces of the slider which gives big shifts [21 11 1 values on each click].
I want to make smaller shifts/jumps when clicking on the empty space of the slider. The picture explains the empty space as and jumps. I could not find any option to set this functionality in slider's settings.
I have the following settings
ihist=[0:0.0005:0.015];
colors=1:0.01:1.25;
handles.output = hObject;
% % Update slider1 value
guidata(hObject, handles);
maxSliderValue = length(ihist);
minSliderValue = 1;
theRange = maxSliderValue - minSliderValue;
steps = [1/theRange, 10/theRange];
set(handles.slider1, 'SliderStep', steps,'value',1);
As the total steps are 31 in this case, therefore the slider should not move completely in 3 steps/clicks.
You might have misunderstood how the the SliderStep
setting works. Quoting from the documentation:
Slider step size, specified as the array,
[minorstep majorstep]
. This property controls the magnitude of the slider value change when the user clicks the arrow buttons or the slider trough (slider channel):
minorstep
is the fraction of the slider range by which theValue
property increases or decreases when the user clicks one of the arrow buttons.
majorstep
is the fraction of the slider range by which theValue
property increases or decreases when the user clicks the slider trough.
In your example, [minorstep majorstep]
is [1/theRange, 10/theRange]
(or [1/30 1/3]
numerically), which means that you need exactly (1/3)^-1 == 3
clicks to traverse the entire range. If you want 30
clicks to be required (note that you have 1 fewer intervals than slider positions, |--|--|
), change majorstep
to 1/theRange
as well.