Creating a 360 GUI knob

I need to create a GUI to control the direction in which an arrow is facing. The obvious control is the Knob, which conveys direction visually. EXCEPT that the Knob (at least as far as I can tell) has a fixed range from about -160 degrees to +160 degrees (with 0 being vertical). Which leaves me with two options:
Use the range -160 to +160 to allow the user to specify -180 to +180, which has the horrible effect that dial angle and arrow angle are not the same
Use the range -160 to +160 to allow the user to specify -160 to +160, which means my dial angle and my arrow angle are the same but has the horrible effect that the user can never point the arrow straight down!
What I really need is a control that just spins and returns the angle it's pointing at, but short of that is there a way to get the Knob to behave as I need?

5 个评论

Documentation does not show a way to change knob design. You can use gauges and edit data in another way (like + - buttons) or you can use discrete knob.
Unfortunately, the discrete knob has the same restriction on angles. It looks like I am going to have to use a slider, which is too bad because a knob is the perfect visual control for angle.
Caglar
Caglar 2018-11-2
编辑:Caglar 2018-11-2
There is no direct solution for a full-knob even in Undocumented Secrets of Matlab-Java Programming book.
Though you could probably pull in a package such as https://github.com/sojamo/controlp5/blob/master/src/controlP5/Knob.java and put the knob into a JPanel, perhaps using hints from https://undocumentedmatlab.com/blog/customizing-matlab-uipanels
Lane
Lane 2018-11-2
编辑:Lane 2018-11-2
Thanks! If the quick-and-dirty tool I am building becomes a workhorse, I may go back and try some customization. For now I'm just going to put in an unintuitive slider and an accompanying figure that shows orientation.

请先登录,再进行评论。

回答(0 个)

类别

帮助中心File Exchange 中查找有关 MATLAB Parallel Server 的更多信息

产品

版本

R2018b

提问:

2018-11-2

编辑:

2018-11-2

Community Treasure Hunt

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

Start Hunting!

Translated by