I am trying to capture return key event on the on a juce Button within a component. I have used the function addShortCut and passed KeyPress::returnkey within. The problem is when i press enter key on the component, the application loads previous components for a brief period of time and then comes back to the component on which enter key was pressed.
It might have been the case that some of the listeners of previous components may have got automatically invoked. To rule out this possibility, i tried removing all the listeners of the other components and also tried using the method setKeyboardFocus(false) on other components (so that the focus wont go there in any case), but the problem persisted. I also tried to delete the previous components, but surprisingly, they were somehow still loaded for a brief time when i press enter.
I also tried using getKeyPressed instead of addshortcut method and also adding keylistener manually. But with no luck.
CAn somebody help?