I’ve encountered something weird when using TextEditor. For instance, the caret is not actually visible, though isCaretVisible returns true. And for second, I am not able to write anything in the editor.

This is the code:

text1.setMultiLine (true);
text1.setReturnKeyStartsNewLine (true);

Do I need to add anything else?

setReadOnly (bool shouldBeReadOnly) ?

From what I’ve gathered, the TextEditor is by default not read-only and isReadOnly is false, so I should be able to type…but nothing happens.

The textEditor box is actually visible and you have clicked it to set it active, right?

Yes, the textEditor is visible. The cursor for typing appears and I’ve tried typing, but to no effect. Should I add a Listener or something like that? I’ve got the ideea from a tutorial that it isn’t necesarry, maybe I’m wrong.

No listeners required or anything like that. I have just tested this to check I’m not going mad and have no problem writing into a text editor created like you describe. Can’t think what you’re doing that is strange.

TIP: Setting the component’s size before adding it is a little wierd. Put the text1 setBounds() code in the parent component’s resized() method so it can respond to changes in the parent size.

Ok, thanks for your input. I think there’s an issue with the caret, meaning I just set it to visible (though it’s visible by default) and it doesn’t appear. You were able to see it, I presume? Either way, thank you for your patience once again.


Post your entire parent component class source here . .

Okay, here it goes:

class XAudioProcessorEditor : public AudioProcessorEditor

private: TextEditor text1;
XAudioProcessorEditor (XAudioProcessor* ownerFilter);
void paint (Graphics& g);


XAudioProcessorEditor::XAudioProcessorEditor (XAudioProcessor* ownerFilter)
: AudioProcessorEditor (ownerFilter)

// This is where our plugin’s editor size is set.

setSize (700, 700);


I’ve tried a simplified version with the Introjucer and it’s the same, I can’t type and the caret is not visible. I can copy, cut, paste etc though.

So you can select the text with mouse drag, right click in the box and get a popup menu?

check the keyboard focus. `setWantsKeysboardFocus(true)’ on your component.

I’ve got no text to select, but I can right click and get a pop-up menu, I can use paste, select all etc.

I’ve used something like this (I didn’t find setWants…):

and it returns false. Could this be the issue?

Hugh made a tiny typo. Should be . .


Thank you all for your replies!

Yeah, I found it, but still hasKeyboardFocus(true) returns false. That damned caret doesn’t appear.

Have you made sure Plugin editor requires keyboard focus is ticked in your Introjucer project?

If so what host and plugin type are you building?

Have you tried the same set-up with a normal (non-plugin) app? Does that get text entry correctly?

Yes, it worked! Thank you so much! Apparently [quote]some hosts can be a bit funny about keyboard focus[/quote] Awesome and thank you all for your answers and patience!