in 2020, what is the best / recommended / idiomatic way to implement a custom component - advanced rotary slider:
- with drag&drop functionality (making links)
- custom graphics
- label on top and value on bottom
- displaying a range values (e.g. total range 0-100, highlighting selected range 30-50 with different color)
- showing label on top and value bottom
- possibly combining button and slider (on/off trigger)
- showing small hint or menu when pressing Ctrl
- Attached and responding to AudioProcessorValueTreeState
I would prefer option which is simple yet flexible and open to future enhancements and a general concept/approach which could be used for smart buttons or other components.
- Slider with other separate components created by a factory pattern
- Class derived from Slider with additional methods and graphics rendering with separate custom Look & Feel v4
- Class derived from Component with composed Slider, Label etc incl paint/resize graphics rendering
- Any better / more preferred alternative or how to chose recommendations?
Thank you for your help in advance!
As i just did this a week ago, i could help here
Fist, i had look at this files:
here, you will have the base to get some image custom rotary sliders, as well as some full vector knob great start, isnt it ?
then, as you mention your needs, the value and the knob “title” can be easily added within:
for the value by example:
Slider_Img_1.setTextBoxStyle(Slider::TextBoxBelow, false, 60, 20);
Slider_Img_1.setRange(0.0, 127.0, 1.0);
then create a label:
and finally, in the resize, only theknob ! :
Slider_Img_1.setBounds(600, 70, 66, 84);
hope that helps have a nice day
I’d avoid option 2, Slider is already enough of a beast.
By your description, I’d go with option 3 because it sounds like you consider that as a reusable widget that communicates as a single entity with the rest of the UI, and handles internally all the mutual updates of the composed Components that make up your complex widget.
Option 1 is a route more apt if you see your set of composed components more like a section in your UI rather than a complex widget. This is the choice I’d take if I had to implement a channel strip for a mixer, for example.