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

**URL:** <https://forum.juce.com/t/buttonclicked-fires-when-user-presses-return-enter-key/23236>\
**Category:** General JUCE discussion\
**Created:** [July 7, 2017, 8:13pm UTC](https://forum.juce.com/t/buttonclicked-fires-when-user-presses-return-enter-key/23236 "2017-07-07T20:13:50Z")\
**Posts on this page:** 1\
**Showing post:** 4

<div class="post-metadata">

**Author:** ![chkn](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/chkn/32/3862_2.png) [@chkn](https://forum.juce.com/u/chkn)\
**Post date:** [July 7, 2017, 8:19pm UTC](https://forum.juce.com/t/buttonclicked-fires-when-user-presses-return-enter-key/23236/4 "2017-07-07T20:19:45Z")

</div>

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()
{
    disableAllButtonsKeyboardFocus(*this,*this);
}

void disableAllButtonsKeyboardFocus(AudioProcessorEditor& me,Component& component)
{
    for (int i=0; i<component.getNumChildComponents(); i++)
    {
        Component* child=component.getChildComponent(i);
        child->setWantsKeyboardFocus(false);
        child->setMouseClickGrabsKeyboardFocus(false);
        me.disableAllButtonsKeyboardFocus(me, *child);
    };
}
```

---

_[View the full topic](https://forum.juce.com/t/buttonclicked-fires-when-user-presses-return-enter-key/23236)._
