How to enable "Snap to Tick" for a slider in App Designer?

22 ビュー (過去 30 日間)
Farzam Malmir
Farzam Malmir 2019 年 2 月 21 日
コメント済み: Fryderyk Kukowski 2024 年 8 月 11 日
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 件のコメント
Farzam Malmir
Farzam Malmir 2019 年 2 月 22 日
In the same slider you posted, for example I want the slider handle sits on the tick intervals not between them. for example I want 1, 2, 3 ... rather than 1.48
Jesse Beaupre
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
Kevin Chng 2019 年 2 月 22 日
Untitled.png
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 件のコメント
Jeff Severino
Jeff Severino 2019 年 7 月 2 日
clever!
Fryderyk Kukowski
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 ExchangeDevelop Apps Using App Designer についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by