Graphical dial control...

BlitzMax Forums/BlitzMax Programming/Graphical dial control...

Arowx(Posted 2010) [#1]
I'm going to write a simple Dial control for use in the GAF framework but how would you expect it to work..

MouseDown and move would...

1. turn the dial to follow the mouse pointer.
2. changes in mouse Y value turn the dial up or down.

I would think it's the first then you can just click the position you want and the dial turns to that position?


GfK(Posted 2010) [#2]
1.


matibee(Posted 2010) [#3]
Fruity loops makes extensive use of (2) and it feels quite natural.


Muttley(Posted 2010) [#4]
Most audio software uses 2 and it works pretty well.


therevills(Posted 2010) [#5]
What about both?

The first click sets the position, then the mouse down to fine tune it ;)


Brucey(Posted 2010) [#6]
My RadioBaH app has a dial that you can either click and drag or use the mouse-wheel.


Arowx(Posted 2010) [#7]
Does the drag adjust the angle or the value?


Brucey(Posted 2010) [#8]
The angle is the value / the value is the angle.

The drag itself adjusts the value, which you then apply to the angle when you draw it.
In my case, a volume dial uses this :
		Local angle:Double = 30.0 + 300.0 * volume
		
		cairo.MoveTo(27 - Sin(angle) * 13.5, 60.5 + Cos(angle) * 13.5)
		cairo.LineTo(27 - Sin(angle) * 16, 60.5 + Cos(angle) * 16)

There volume is a value between 0 and 1.
The dial can move between 30 and 300 degrees (rather than a full circle).

Dragging or scrolling affects the "volume" value.
The volume changes as per X and/or Y drag of the mouse.
					If MouseX < lastX Or MouseY > lastY Then
						ChangeVolume(-1)
					ElseIf MouseX > lastX Or MouseY < lastY Then
						ChangeVolume(1)
					End If

Nothing too complex. :-)


DavidDC(Posted 2010) [#9]
Good old RadioBah... one of my favourite apps. Always wondered exactly how you did the volume control.