I’ve had a few “special order” requests concerning disabling sliders in my plugins. It would be nice to add a right click option to my slider class (which inherits from the Juce Slider class) to allow people to disable the slider. Is there an easy way of doing this? Searching for how to add right click options to Juce components didn’t work for me, but maybe there is some obvious thread I have missed.
It doesn’t have any mechanism for adding to the built-in menu, but you could always just grab the mouse-click yourself and override it if you need some custom behaviour like that.
void mySlider::mouseDown(const MouseEvent &e) {
ModifierKeys modifiers = ModifierKeys::getCurrentModifiersRealtime();
// check the mod keys ..
if (modifiers.isRightButtonDown() || modifiers.isCtrlDown())
{
// do some stuff .. like display a menu
}
else
{
Slider::mouseDown(e); // to the usual thing .... drag the slider
}
}