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?


1 Like

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);
1 Like

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.

1 Like

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…

Thanks guys for this thread.
Had the same problem!

i’m a heavy cubase user but i can’t recall enter being a button that i use a lot of times… not even sure if i ever use it for anything. but i guess some people like to use more key commands than me… also i think a plugin should try to have as less key commands as possible so that situations like this become clearer. imagine a plugin that utilizes the space key outside of a textbox for example. a problem with enter is more of an edge case imo