Command/Ctrl+click instead of Option/Alt+Click for default?

In the slider’s pimpl code, there is this code in mouseDown:

        else if (canDoubleClickToValue()
                  && e.mods.withoutMouseButtons() == ModifierKeys (ModifierKeys::altModifier))

This code detects the Option/Alt key plus mouse click to reset the slider to the parameter’s default value. That is fine for AAX and AudioUnits plug-ins, but isn’t the standard for VST3 (and maybe VST2?) to use the Command/Ctrl+Click instead? That is what Cubase and Studio One use for their controls, at least.

All our existing products in the field (which were based on VSTGUI), work like that, and our customers would expect them to keep that behavior (and so would anyone used to the way Cubase and Studio One do it, I would imagine).

I don’t see any way to modify my sliders/knobs so that they work with the Command/Ctrl+Click when it’s a VST build. Is there any way to make that happen?

You may have to derive from Slider (or edit your copy of JUCE, but I don’t like resorting to that!) to hold a ModifierKeys that can be set based on the format of the plugin (although I think format is only provided to you at runtime?). Then you can override mouseDown() to check that member ModifierKeys and reset the slider value. Otherwise pass the event back to the super class

You will likely have to also make a call to setVelocityModeParameters() to change what allows velocity mode, since the default is CMD/CTRL + Click

That would be ok, except that mouseDown is not a function that you can override in Slider-derived classes. It is inside the Slider::Pimpl class.

Right, Slider::mouseDown() just calls the private implementation mouseDown(), so if you override it you can catch the event first

But it is true the private implementation would still contain the default behavior… So for subclasses you might have to just use Slider::setDoubleClickReturnValue(false, ...) and handle the double click and modifier click yourself, then send anything else to the super class

Either way this should also be documented in JUCE, doesn’t seem to say anywhere that this alt clicking is enabled when using setDoubleClickReturnValue() :slight_smile:

1 Like

I’ve added an optional argument to that method so you can specify a different modifier key, or none at all if you’d like:

6 Likes