No keyboard input?

Hello all,

I’m certain I remember some discussion of this in the past – I can’t seem to get keyboard input to a TextEditor field in my GUI.
I’m running on a Mac with a simple GUI consisting of a couple of text input fields and a TableListBox.

Does the top-level component have to be a KeyListener?
Does it have to grab KBD focus?

I have code (in resized()) telling all other widgets setWantsKeyboardFocus(false) and telling the text editor component,


Could someone elucidate me as to what I’m forgetting?

…any reply appreciated…


One more think: my app happily echoes keyboard input to its stdout.


I’ve no idea how you’d manage to stop a TextEditor getting focus - that’s exactly what they’re designed to do, you don’t need to call anything special to make it happen. Perhaps try not calling setWantsKeyboardFocus() on it? The juce demo is full of texteditor examples - perhaps have a look at those and see what you’re doing differently?

Thanks for the note, Jules.

I replaced my project file with the HelloWorld demo and it works – still not certain what I was doing wrong…


Not anymore it seems :frowning:

There are plenty of examples it’s just that they’re implicit. If you grep for TextEditor in the examples folder you will see that it’s used in various examples.

Also, keep in mind the docs online provide all of the pertinent details:

The Juce docs are indeed good, but they would be GREAT if an example was added to EACH class, meaning each page of class doc, had a simple example to get beginners going.

When searching I see beginners over and over asking all the same questions! I don’t know about all the others who have asked what I have suffered with, but I admit had my knowledge about C++ been better, I would probably not have had so much trouble.

I am literally spending a day or two looking through examples and docs before finally resorting to “bothering” one of you experienced people, of which I hope to become one day, and yes with the gracious help I eventually get my problem solved, only to get into another the very next day! I can tell you it is extremely frustrating! Especially since I can sense people trying to help kind of get a little irritated, since they keep referring to the docs. I can feel I am getting to the point of just giving up, and I can only imagine others feeling the same and I do not think that is what the JUCE developers want, people to give up. I think more examples are needed to get us noobs going fast!

One thing I also noticed when searching this forum, for past problems asked by beginners, is that I saw many answers were with references to “JUCE Demo” which seems to have disappeared, or reworked with a 5.3 update. Perhaps some additional demos are needed from those “old” demos that are no longer in the new examples?

Anyways if everybody knew as much all you experienced people, there would be little point to this forum other than for feature request.

I’ll PM you to avoid continuing on a dug up old thread