TextEditor Justification


Is it possible to set the justification of the TextEditor control?

I know its not possible in the traditional manner, but is there a way?


The code is not there to do it. I asked for this feature a while back.

The TextEditor needs a big internal overhaul to give it a structure that can handle that. It’s on my to-do-list but is quite a serious job, so can’t say how soon I’ll have time to do it.

Whenever you do get around to it, I hope you consider turning the TextEditor into a souped up RichTextEditor that has support for things like multiple/different fonts, multiple/different text colors and multiple/different paragraph attributes (justification, etc).

Jules I would be happy if I could get a TextEditor that supported center-justification just for the 1-line case (i.e. no multiline text). I need it for my centered text Label which goes into edit mode. Perhaps that could be done a lot more easily?

It’d certainly be easier than a full re-write, but since a full re-write is inevitably going to be necessary at some point, I’m not keen on spending time making temporary fixes that will be thrown away later.

I would also be grateful for this feature! It would also be great if the justification of a TextEditor created by clicking on a Label matched that of the Label - at the moment it looks a bit funny above rotary sliders when the user clicks a centered label and gets a left-justified TextEditor.

Interested me too in this problem. Any news about some workaround possible?

+1 :)

+ 1 !

+1 smiley



You might also consider to involve Slider TextBox to this change. It would be really helpful, if I can custimize that too. At this point you can only set the position to 4 fixed location but nothing else (at lest that's how I understand it).


edit: also when using Label, you cannot get to the underlying TextEditor (because it is created only when needed and then disposed of), which kind of complicates things. e.g. you cannot set the input filter (when you want to use it for editing numbers, which is common cas... ). Also Slider label is intended to show/edit numbers, but you can type anything there... It is than checked and converted in atoi style. It might be a good idea to let the user insert only digits there.

+1 in 2016 as well... :-)


Seriously, this thread is nearly 5 years old and you still cannot set justification for TextEditor.

Jules, you might delegate that big overhaul to someone else at ROLI since the team has grown up a bit... Trust them :-)




The team has grown, but so has the amount of work we need to do! We're currently understaffed and desperately looking for developers to join!

A pitty London is so far away :-)

By the way - is there a good reason, why filterNewText is private in LengthAndCharacterRestriction? I wanted to inherit it and extend it so that it also takes care of multiple decimal points, but seems I am out of luck because I cannot call the inherited method. Therefore I need to duplicate the LengthAndCharacterRestriction functionality in my own filter...

Hmm. Good point actually, there's no reason why it shouldn't be public. You can actually already write legal code that calls it, by simply casting the object to its base class, where the virtual method is public. I'll tweak that, thanks!

Or I can aggregate it instead of inheriting it... Thanks Jules.

One more related question: The input filter influences only direct keyboard input but has no effect when calling setText(). Do I need to execute it somehow manually or do I miss something? Basically there's no problem in getting the filter from the textbox and executing it and than passing the result to the text box. It's only that I would expect the filter to kick in automatically...

Yeah, setText assumes that you know what you're doing!