How to enable "Snap to Tick" for a slider in App Designer?
조회 수: 22 (최근 30일)
이전 댓글 표시
Hi, I want to know how to make a slider move discretely rather than continuously. As an example, I want the slider to jump from 1 to 2 when I move it. In other words, I need to enable the "Snap to Tick" feature.
Thanks in advance.
댓글 수: 3
Jesse Beaupre
2023년 6월 15일
In the callback make the slider value rounded and then set the slider position to this rounded value.
답변 (1개)
Kevin Chng
2019년 2월 22일
Is it what you expect? If you are using app designer, on your left hand side bottom, there is configuration you may edit. Empty the minor tick, and modify the major tick to 1,2,3,4,5.
Don't forgot to change the limit as well to 0,5
댓글 수: 4
Fryderyk Kukowski
2024년 8월 11일
@Kevin Chng It does not work.
My slider settings:
I have set up slider functions like this:
function SliderValueChanging(app, event)
app.Slider.Value = round(event.Value);
end
function SliderValueChanged(app, event)
app.Slider.Value = round(app.Slider.Value);
end
But the slider behaves like this:
So the SliderValueChanging has no effect.
Is there a way to fix this?
참고 항목
카테고리
Help Center 및 File Exchange에서 Develop Apps Using App Designer에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!