Implementing a debugging/console into my Juce application

#1

Hi,

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?

Thanks,
bob

0 Likes

#2

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

0 Likes

#3

OK. This works better…

std::string tmp = “hello world”;

editor->setCaretPosition(editor->getTotalNumChars());
editor->insertTextAtCaret(tmp);

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?

0 Likes

#4

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!

1 Like