How can I implement a multiline Text editor using Slate?

I’m looking to add a multiline text editor into one of my projects.

Problem is, I’ve been through all the SEditableTextBox and variants and none seem to allow multi line editing.

They seem to only allow single line edits and the enter key submits the response. (Even if you paste some text with \r\n inside it it seems to get trimmed out).

Is there any way to disable this and allow multiline edits?

Have you seen SMultiLineEditableText?

That does seem to do the trick for the multiline strings. It doesn’t seem editable though. Looking at the source, it’s missing the TypeChar function stuff set in SEditableText:

void SMultiLineEditableText::TypeChar( const int32 Character )
{
}

It only seems to be used in STestSuite.cpp at the moment, and isn’t editable. Am I missing some way to override the function?

Yeah - I should be fine to implement it. Thanks for your help in tracking down that class though.

Oh :frowning:

I’ll be honest, our multi-line text editing support has received very little love.

Do you feel confident enough about implementing that function for SMultiLineEditableText (I can’t imagine it will be too different from SEditableText). If you do, that’s great! If not, I’ll raise a bug about it internally.

Cool, if you get it working then a pull request for the change would be awesome :slight_smile:

It looks like most of the functions that handle actual text editing are currently stubbed out (more than just TypeChar), so it should hopefully just be a case of implementing them based on SEditableText.

Just to let you know (and I wasn’t aware of this at the time), but someone at Epic has been working on adding a multi-line text edit control to Slate.

They’ve now passed this work over to me to finish off, so hopefully we should have a working (although admittedly basic at this point) multi-line text edit control for 4.3 (we just need to make sure it hasn’t caused any regressions).

oooh wow, that sounds exciting Jamie!

I look forward to playing with it once you are done with it!

#:heart:

Rama

Awesome stuff - looking forward to typing \n in \n Unreal \n :slight_smile:

I will look at it as soon as possible in preview

hazzah, the new SMultiLineEditableText has arrived!

I use SMultiLineEditableText right now but the scrollbar is not working.

They are not show, even if I put my own VScrollbar, i traced the code and the problem seam related that they are not in a SMultiLineEditableText child, they exists but not draw since they are not really linked to the main widgets…

How have you set-up the scrollbars? Please feel free to open a new AnswerHub question for this, and we can discuss it there :slight_smile:

its a bug, i was not able to make it work since the control is not finished, sound like they forget to complete the scrollbar section

it will scroll its just they are not rendered

SMultiLineEditableTextBox uses the HScrollBar and VScrollBar on SMultiLineEditableText to handle its scrollbars, so it does work (see SMultiLineEditableTextBox::Construct).

How have you set-up your scrollbars? You are responsible for actually adding them to the layout, the HScrollBar and VScrollBar are just handles to the scroll bars that get updated as the text content is changed.

I traced in the code, the scrollbar don’t exists on screen, they are not rendered, they work but they are not rendered…

The control is not finished, a lot of stuff related to scrollbar are just not working, the paddingscrollbar stuff are in the control and are not used…

well with 4.9.1 i mean, i did not check they other version

So you’ve added your scrollbars to your widget layout somewhere? As I said before, SMultiLineEditableText will not do this for you, and neither will SMultiLineEditableTextBox if you provide custom scrollbars (as it’s assumed you want to place them at a custom location).

SMultiLineEditableText can appear to scroll even without having actual scrollbars.

The scrollbar padding is only used when SMultiLineEditableTextBox generates its own scrollbars, as it has no control over where your custom ones will be added.

ok now I understand why nothing is show lol

I will need to add mine in the background somewhere using a scrollbox? or I need to handle all manually?

this control in my opinion should handle scrollbar better then this

in my opinion its not intuitive to work like this. i wasted so many time with this control just for the scrollbar… and no document explain how it work