KeyListener Issue with multiple DocumentWindow classes


Hi all,

I'm developing a JUCE application where the main content component derives from OpenGLAppComponent. The main component derives from OpenGLAppComponent. To that component, I added a KeyListener and a MouseListener. At this point, everything worked as I expected - in particular, key and mouse events were correctly processed.

Then I needed additional tool windows (see attached screen shot - the windows labeled "DataViewer" and "Rendering" are the ones that I am referring to). I created a ToolWindow class which derives from DocumentWindow, and then create instances of these with their appropriate content components, and set them to visible.

While for the most part things work as I want them to, when I created the additional DocumentWindow instances, the KeyListener stopped working (the KeyListener is listening to the OpenGLAppComponent) - i.e. keys are not intercepted anymore, even when the main content component has the focus. Mouse still works, though.

I tried adding the same KeyListener to the additional DocumentWindow classes, but that didn't help either.

Any ideas on what might be the issue? Is DocumentWindow the wrong base class to use for a scenario where I want multiple tool window type widgets and one main window to receive the keys?






If you're using global key shortcuts you'd probably need to add KeyListeners to all your windows. Most likely in this case it's just that the focused component isn't the one you're listening to.