Implementing a debugging/console into my Juce application


I’m trying to create a UI element that will be used to display debug tracing from my application. Think of it as an IDE’s console where std::cout and other messages will be continuously written to.

I’ve played around with the TextEdit component but that is very slow as the text buffer grows.

Ideally, I could set a total buffer size that would be displayed. I also want to be able to copy the buffered text to the clipboard.

Any recommendations about what Juce components might work well for this?


I think, TextEditor is your best bet. How are you adding the text?

OK. This works better…

std::string tmp = “hello world”;


My original implementation:

juceString newStringToAppendToEnd = “hello world”;

juce::String str = textEdit->getText();
textEdit->setText(str + tmp);

Is there a more efficient way of appending text to the end?

Not sure if it is exactly what you want, but I implemented a component that displays stdout/stderr prints. It also uses a TextEditor for that. Maybe it might help you… Just build the example project and check out its functionality!