Hans-Dieter Kosch wrote on Wed, 02 Apr 2014 04:24:47 +0200:
I regard a rotary poti just like a linear one. The difference is that a circle has basically no start and no end...
Well, what about the following then? Let the default definition for a rpotmeter be default;x;y;X;Y. Now be: start = atan2 transformation of x,y end = atan2 transformation of X,Y range = end - start (add 1 if <= 0) gap = 1 - range To handle the rpotmeter similar to the linear ones, let a point x,y clicked on be p: p = atan2 transformation of x,y - start (add 1 if <= 0) We have a kind of linear potmeter starting with 0 of width range now and calculating the item's value is simple: if p <= range then value = (p / range) * 100 else if p < range + gap / 2 then value = 100 else value = 0 So, guiItem only needs to provide start and range. (All names are just examples.) Attached is a quick and dirty proof of concept (for plastic skin and main.c only; although more universal, because it should work for arbitrary start and stop points, it seems simpler). Can you detect any faulty reasoning? Anything I might have missed? Ingo