I need an element that functions like a ‘push-button encoder’ - it’s similar to a standard PARAM with infinite rotation and the ability to click on it.
I’ve figured out how to achieve infinite rotation ( configParam(MY_PARAM, -INFINITY, INFINITY, 0); ), but I haven’t yet figured out how to detect clicks on the knob (if it’s even possible to do so).
Has anyone encountered this before or can offer advice?
Yes, it is possible to react to mouse clicks. Every widget receives mouse notifications. Here is an example of capturing mouse clicks in my Sapphire Tricorder module.
Exactly! That’s exactly what we need. But it seems like Erica Synths Pico Drums doesn’t have open-source code. Do you happen to know how it’s implemented?
As far as I understand, you’re creating a separate component to handle the clicks. So, is it not possible to simply use a standard PARAM and obtain information about the clicks within the module’s code?
However it works I hope you improve on it as the pico drums do recall the settings but after reloading a patch and turning the knob it always jumps to the initial state.
There might be, if someone has already written a widget class for that. There are “latch” buttons that toggle state on every press. And there are knobs that rotate. My guess is, you will have to create your own hybrid widget that has both behaviors. Studying existing code could help you achieve that.
But it’s not that unusual for VCV Rack plugin developers to create their own mouse handling and graphics rendering code for custom controls.