Texteditor: Default text does not wrap when in multiline mode


#1

Hey,

I have Texteditor that is set to multiline mode with word wrap. Entered text is displayed and wrapped correctly. But if the default text is longer than a single line it gets chopped of.

Best,
Thomas


#2

And the default text justification doesn’t match the regular text justification. It’s just always centered.


#3

Try

 setMultiLine(true, true);

https://docs.juce.com/master/classTextEditor.html#a939bf23c983f695379a92f9612928160


#4

As I’ve said:
Multiline works. But only for the actual text. But you can also set a default text that is shown when the editor is empty. And this default text doesn’t get wrapped. It’s just a single line with three dots at the end.


#5

I don’t know what a ‘default text’ means.
I use something like this and it works great for me:

class InfoPanel : public TextEditor
{
public:
	InfoPanel()
	{
		setMultiLine(true, true);
		setReadOnly(true);
		setFont(18.0f);
        setText("We are asked to provide more and more bespoke services that are all desirable - but the simple fact is there are too many desirable and deserving issues.");
	}

#6

I mean the text set with setTextToShowWhenEmpty().


#7

Oh yes, sorry. I think Juce presumes it’ll be a simple instruction to the user, like ‘user name’ which will be short and to the point.