buttonClicked() fires when user presses return/enter key?


I’m not sure how this is happening, but inside Cubase, if I press the return key my buttonClicked() function is called. Never noticed that before. It happens whether I have PluginWantsKeyFocus checked or not.

How can I disable this behavior?



this is a problem, i could only solve this only via setting this on every component (also nested components)




Why would this be considered normal behavior?

And thanks for the quick reply.


you could add this to your plugin gui component, which iterate through all child (and nested child) objects

just call disableAllButtonsKeyboardFocus() in the constructor

void disableAllButtonsKeyboardFocus()

void disableAllButtonsKeyboardFocus(AudioProcessorEditor& me,Component& component)
    for (int i=0; i<component.getNumChildComponents(); i++)
        Component* child=component.getChildComponent(i);
        me.disableAllButtonsKeyboardFocus(me, *child);


Thanks. That worked like a champ.

As I said before, I’m curious why this is the default component behavior.


If you use the GUI without a mouse, it is normal behaviour to step the focus through the components via tab key. If the button has the keyboard focus, an enter key event would be considered a buttonClicked().
Otherwise there would be no way to use a GUI without a mouse/pointing device.
This behaviour is found in most GUI-s including browser websites etc.
Also for accessibility I think this is important to allow at least one alternative to using the mouse.


I had a user report that when he pressed Return/Enter for a specific key command on Cubase, my plugin responded as if a random button had been pushed…basically calling buttonClicked(). I tried changing the PluginWantsKeyFocus and it still responded the same way.

What would be the correct way to deal with this?


We’ve got this problem too … is it new, or have I never notice this before!?


Apparently I’ve just never noticed it before. Is this a regular complaint from Cubase users who use Enter for something important DAW related…