SMultiLineEditableText

An editable text widget that supports multiple lines and soft word-wrapping.

Choose your operating system:

Windows

macOS

Linux

Inheritance Hierarchy

SWidget

ISlateEditableTextWidget

SMultiLineEditableText

References

Module

Slate

Header

/Engine/Source/Runtime/Slate/Public/Widgets/Text/SMultiLineEditableText.h

Include

#include "Widgets/Text/SMultiLineEditableText.h"

Syntax

class SMultiLineEditableText :
    public SWidget,
    public ISlateEditableTextWidget

Remarks

An editable text widget that supports multiple lines and soft word-wrapping.

Variables

Name Description

Protected variable

TWeakPtr< FActi...

 

ActiveTickTimer

The timer that is actively driving this widget to Tick() even when Slate is idle

Protected variable

float

 

AmountScrolledWhileRightMouseDown

How much we scrolled while RMB was being held

Protected variable

TAttribute< boo...

 

bAllowContextMenu

Whether the context menu can be opened

Protected variable

TAttribute< boo...

 

bAllowMultiLine

Whether to allow multi-line text

Protected variable

TAttribute< boo...

 

bClearKeyboardFocusOnCommit

True if we want the text control to lose focus on an text commit/revert events

Protected variable

TAttribute< boo...

 

bClearTextSelectionOnFocusLoss

Whether to clear text selection when focus is lost

Protected variable

TAttribute< boo...

 

bIsReadOnly

Sets whether this text box can actually be modified interactively by the user

Protected variable

bool

 

bIsSoftwareCursor

Whether a software cursor is currently active

Protected variable

TAttribute< boo...

 

bRevertTextOnEscape

True if any changes should be reverted if we receive an escape key

Protected variable

TAttribute< boo...

 

bSelectAllTextWhenFocused

Whether to select all text when the user clicks to give focus on the widget

Protected variable

TAttribute< boo...

 

bSelectWordOnMouseDoubleClick

Whether to select work on mouse double click

Protected variable

TUniquePtr< FSl...

 

EditableTextLayout

The text layout that deals with the editable text

Protected variable

TSharedPtr< SSc...

 

HScrollBar

The horizontal scroll bar widget

Protected variable

TSharedPtr< FEx...

 

MenuExtender

Menu extender for right-click context menu

Protected variable

EModifierKey::T...

 

ModiferKeyForNewLine

The optional modifier key necessary to create a newline when typing into the editor.

Protected variable

FOnContextMenuO...

 

OnContextMenuOpening

Delegate to call before a context menu is opened

Protected variable

FOnCursorMoved

 

OnCursorMovedCallback

Called when the cursor is moved within the text area

Protected variable

FOnUserScrolled

 

OnHScrollBarUserScrolled

Called whenever the horizontal scrollbar is moved by the user

Protected variable

FOnIsTypedCharV...

 

OnIsTypedCharValid

Called when a character is typed and we want to know if the text field supports typing this character.

Protected variable

FOnKeyChar

 

OnKeyCharHandler

Callback delegate to have first chance handling of the OnKeyChar event

Protected variable

FOnKeyDown

 

OnKeyDownHandler

Callback delegate to have first chance handling of the OnKeyDown event

Protected variable

FOnTextChanged

 

OnTextChangedCallback

Called whenever the text is changed programmatically or interactively by the user

Protected variable

FOnTextCommitte...

 

OnTextCommittedCallback

Called whenever the text is committed.

Protected variable

FOnUserScrolled

 

OnVScrollBarUserScrolled

Called whenever the vertical scrollbar is moved by the user

Protected variable

FVector2D

 

SoftwareCursorPosition

The current position of the software cursor

Protected variable

TAttribute< EVi...

 

VirtualKeyboardDismissAction

The message action to take when the virtual keyboard is dismissed by the user

Protected variable

FVirtualKeyboar...

 

VirtualKeyboardOptions

Options to use for the virtual keyboard summoned by this widget

Protected variable

TAttribute< EVi...

 

VirtualKeyboardTrigger

The type of event that will trigger the display of the virtual keyboard

Protected variable

TSharedPtr< SSc...

 

VScrollBar

The vertical scroll bar widget

Constructors

Name Description

Public function

SMultiLineEditableText()

Destructors

Name Description

Public function

~SMultiLineEditableText()

Functions

Name Description

Public function

void

 

AdvanceSearch

(
    const bool InReverse
)

Advance the current search to the next match (does nothing if not currently searching)

Public function Const

bool

 

AnyTextSelected()

Query to see if any text is selected within the document

Public function

void

 

ApplyToSelection

(
    const FRunInfo& InRunInfo,
    const FTextBlockStyle& InStyle
)

Apply the given style to the currently selected text (or insert a new run at the current cursor position if no text is selected)

Public function

void

 

BeginSearch

(
    const FText& InSearchText,
    const ESearchCase::Type InSearchCas...,
    const bool InReverse
)

Begin a new text search (this is called automatically when the bound search text changes)

Public function

void

 

ClearSelection()

Clear the active text selection

Public function

void

 

Construct

(
    const FArguments& InArgs
)

Public function

void

 

ForceScroll

(
    int32 UserIndex,
    float ScrollAxisMagnitude
)

Force a single scroll operation.

Public function Const

void

 

GetCurrentTextLine

(
    FString& OutTextLine
)

Fill OutTextLine with the text line where the current cursor location is at

Public function Const

FTextLocatio...

 

GetCursorLocation()

Get the interaction position of the cursor (where to insert, delete, etc, text from/to)

Public function Const

FText

 

GetHintText()

Get the text that appears when there is no text in the text box

Public function Const

TSharedPtr< ...

 

GetHScrollBar()

Get the horizontal scroll bar widget

Public function Const

FText

 

GetPlainText()

Returns the plain text string without richtext formatting

Public function Const

TSharedPtr< ...

 

GetRunUnderCursor()

Get the run currently under the cursor, or null if there is no run currently under the cursor

Public function Const

FText

 

GetSearchText()

Get the text that is currently being searched for (if any)

Public function Const

TArray< TSha...

 

GetSelectedRuns()

Get the runs currently that are current selected, some of which may be only partially selected

Public function Const

FText

 

GetSelectedText()

Get the currently selected text

Public function Const

FText

 

GetText()

Returns the text string

Public function Const

TSharedPtr< ...

 

GetVScrollBar()

Get the vertical scroll bar widget

Public function

void

 

GoTo

(
    const ETextLocation NewLocation
)

Move the cursor specified location

Public function

void

 

GoTo

(
    const FTextLocation& NewLocation
)

Move the cursor to the given location in the document (will also scroll to this point)

Public function

void

 

InsertRunAtCursor

(
    TSharedRef< IRun > InRun
)

Insert the given run at the current cursor position

Public function

void

 

InsertTextAtCursor

(
    const FText& InText
)

Insert the given text at the current cursor position, correctly taking into account new line characters

Public function

void

 

InsertTextAtCursor

(
    const FString& InString
)

Insert the given text at the current cursor position, correctly taking into account new line characters

Protected function Const

bool

 

IsRightClickScrolling()

Return whether a RMB+Drag scroll operation is taking place

Protected function

void

 

OnHScrollBarMoved

(
    const float InScrollOffsetFraction
)

Protected function

void

 

OnVScrollBarMoved

(
    const float InScrollOffsetFraction
)

Public function

void

 

Refresh()

Refresh this editable text immediately, rather than wait for the usual caching mechanisms to take affect on the text Tick

Public function

void

 

ScrollTo

(
    const FTextLocation& NewLocation
)

Scroll to the given location in the document (without moving the cursor)

Public function

void

 

ScrollTo

(
    const ETextLocation NewLocation
)

Scroll to the given location in the document (without moving the cursor)

Public function

void

 

SelectAllText()

Select all the text in the document

Public function

void

 

SetAllowContextMenu

(
    const TAttribute< bool >& InAllowC...
)

See the AllowContextMenu attribute

Public function

void

 

SetAutoWrapText

(
    const TAttribute< bool >& InAutoWr...
)

See AutoWrapText attribute

Public function

void

 

SetClearKeyboardFocusOnCommit

(
    const TAttribute< bool >& InClearK...
)

Sets whether to clear keyboard focus when pressing enter to commit changes

Public function

void

 

SetClearTextSelectionOnFocusLoss

(
    const TAttribute< bool >& InClearT...
)

Sets whether to clear text selection when focus is lost

Public function

void

 

SetFont

(
    const TAttribute< FSlateFontInfo > ...
)

See attribute Font

Public function

void

 

SetHintText

(
    const TAttribute< FText >& InHintT...
)

Sets the text that appears when there is no text in the text box

Public function

void

 

SetIsReadOnly

(
    const TAttribute< bool >& InIsRead...
)

Sets the ReadOnly attribute

Public function

void

 

SetJustification

(
    const TAttribute< ETextJustify::Typ...
)

See Justification attribute

Public function

void

 

SetLineHeightPercentage

(
    const TAttribute< float >& InLineH...
)

See LineHeightPercentage attribute

Public function

void

 

SetMargin

(
    const TAttribute< FMargin >& InMar...
)

See Margin attribute

Public function

void

 

SetOnKeyCharHandler

(
    FOnKeyChar InOnKeyCharHandler
)

Sets the OnKeyCharHandler to provide first chance handling of the OnKeyChar event

Public function

void

 

SetOnKeyDownHandler

(
    FOnKeyDown InOnKeyDownHandler
)

Sets the OnKeyDownHandler to provide first chance handling of the OnKeyDown event

Public function

void

 

SetOverflowPolicy

(
    TOptional< ETextOverflowPolicy > In...
)

Sets the overflow policy for this text block

Public function

void

 

SetRevertTextOnEscape

(
    const TAttribute< bool >& InRevert...
)

Sets whether to allow the user to back out of changes when they press the escape key

Public function

void

 

SetSearchText

(
    const TAttribute< FText >& InSearc...
)

Set the text that is currently being searched for (if any)

Public function

void

 

SetSelectAllTextWhenFocused

(
    const TAttribute< bool >& InSelect...
)

Sets whether to select all text when the user clicks to give focus on the widget

Public function

void

 

SetSelectWordOnMouseDoubleClick

(
    const TAttribute< bool >& InSelect...
)

Sets whether to select word on the mouse double click

Public function

void

 

SetText

(
    const TAttribute< FText >& InText
)

Sets the text for this text block

Public function

void

 

SetTextFlowDirection

(
    const TOptional< ETextFlowDirection...
)

See TextFlowDirection attribute

Public function

void

 

SetTextShapingMethod

(
    const TOptional< ETextShapingMethod...
)

See TextShapingMethod attribute

Public function

void

 

SetTextStyle

(
    const FTextBlockStyle* InTextS...
)

See attribute TextStyle

Public function

void

 

SetVirtualKeyboardDismissAction

Set the VirtualKeyboardDismissAction attribute

Public function

void

 

SetWrappingPolicy

(
    const TAttribute< ETextWrappingPoli...
)

Set WrappingPolicy attribute

Public function

void

 

SetWrapTextAt

(
    const TAttribute< float >& InWrapT...
)

See WrapTextAt attribute

Overridden from SWidget

Name Description

Protected function Virtual

void

 

CacheDesiredSize

(
    float InLayoutScaleMultiplier
)

The system calls this method.

Protected function Virtual Const

FVector2D

 

ComputeDesiredSize

(
    float LayoutScaleMultiplier
)

Compute the ideal size necessary to display this widget.

Protected function Virtual Const

bool

 

ComputeVolatility()

Recomputes the volatility of the widget.

Protected function Virtual

FChildren &#...

 

GetChildren()

Returns the useful children (if any) of this widget.

Protected function Virtual Const

bool

 

IsInteractable()

Protected function Virtual Const

void

 

OnArrangeChildren

(
    const FGeometry& AllottedGeometry,
    FArrangedChildren& ArrangedChildre...
)

Compute the Geometry of all the children and add populate the ArrangedChildren list with their values.

Protected function Virtual Const

FCursorReply

 

OnCursorQuery

(
    const FGeometry& MyGeometry,
    const FPointerEvent& CursorEvent
)

The system asks each widget under the mouse to provide a cursor. This event is bubbled.

Protected function Virtual

void

 

OnFocusLost

(
    const FFocusEvent& InFocusEvent
)

Called when this widget loses focus. This event does not bubble.

Protected function Virtual

FReply

 

OnFocusReceived

(
    const FGeometry& MyGeometry,
    const FFocusEvent& InFocusEvent
)

KEY INPUT Called when focus is given to this widget. This event does not bubble.

Protected function Virtual

FReply

 

OnKeyChar

(
    const FGeometry& MyGeometry,
    const FCharacterEvent& InCharacter...
)

Called after a character is entered while this widget has keyboard focus

Protected function Virtual

FReply

 

OnKeyDown

(
    const FGeometry& MyGeometry,
    const FKeyEvent& InKeyEvent
)

Called after a key is pressed when this widget has focus (this event bubbles if not handled)

Protected function Virtual

FReply

 

OnKeyUp

(
    const FGeometry& MyGeometry,
    const FKeyEvent& InKeyEvent
)

Called after a key is released when this widget has focus

Protected function Virtual

FReply

 

OnMouseButtonDoubleClick

(
    const FGeometry& InMyGeometry,
    const FPointerEvent& InMouseEvent
)

Called when a mouse button is double clicked. Override this in derived classes.

Protected function Virtual

FReply

 

OnMouseButtonDown

(
    const FGeometry& MyGeometry,
    const FPointerEvent& MouseEvent
)

MOUSE INPUT The system calls this method to notify the widget that a mouse button was pressed within it.

Protected function Virtual

FReply

 

OnMouseButtonUp

(
    const FGeometry& MyGeometry,
    const FPointerEvent& MouseEvent
)

The system calls this method to notify the widget that a mouse button was release within it.

Protected function Virtual

FReply

 

OnMouseMove

(
    const FGeometry& MyGeometry,
    const FPointerEvent& MouseEvent
)

The system calls this method to notify the widget that a mouse moved within it.

Protected function Virtual

FReply

 

OnMouseWheel

(
    const FGeometry& MyGeometry,
    const FPointerEvent& MouseEvent
)

Called when the mouse wheel is spun. This event is bubbled.

Protected function Virtual Const

int32

 

OnPaint

(
    const FPaintArgs& Args,
    const FGeometry& AllottedGeometry,
    const FSlateRect& MyCullingRect,
    FSlateWindowElementList& OutDrawEl...,
    int32 LayerId,
    const FWidgetStyle& InWidgetStyle,
    bool bParentEnabled
)

The widget should respond by populating the OutDrawElements array with FDrawElements that represent it and any of its children.

Protected function Virtual Const

bool

 

SupportsKeyboardFocus()

Checks to see if this widget supports keyboard focus. Override this in derived classes.

Protected function Virtual

void

 

Tick

(
    const FGeometry& AllottedGeometry,
    const double InCurrentTime,
    const float InDeltaTime
)

Ticks this widget with Geometry.

Overridden from ISlateEditableTextWidget

Name Description

Protected function Virtual Const

TSharedPtr< ...

 

BuildContextMenuContent()

Build the context menu content to use for this widget (if any)

Protected function Virtual Const

bool

 

CanInsertCarriageReturn()

Are we currently able to insert a carriage return? (some widgets have modifier keys that need to be pressed)

Protected function Virtual Const

bool

 

CanTypeCharacter

(
    const TCHAR InChar
)

Are we able to insert the given character into our text?

Protected function Virtual

void

 

EnsureActiveTick()

Ensure that we will get a Tick() soon (either due to having active focus, or something having changed progmatically and requiring an update) Does nothing if the active tick timer is already enabled

Protected function Virtual

TSharedRef< ...

 

GetSlateWidget()

Get the Slate widget this interface is representing (may not be called during destruction)

Protected function Virtual

TSharedPtr< ...

 

GetSlateWidgetPtr()

Get the Slate widget this interface is representing (may be null during destruction)

Protected function Virtual Const

EVirtualKeyb...

 

GetVirtualKeyboardDismissAction()

Get the message action to take when the virtual keyboard is dismissed by the user

Protected function Virtual Const

FVirtualKeyb...

 

GetVirtualKeyboardOptions()

Get the options for the virtual keyboard used for this widget

Protected function Virtual Const

EVirtualKeyb...

 

GetVirtualKeyboardTrigger()

Get the type of event that will trigger the display of the virtual keyboard

Protected function Virtual Const

EKeyboardTyp...

 

GetVirtualKeyboardType()

Get the type of virtual keyboard to use for this widget

Public function Virtual Const

bool

 

IsMultiLineTextEdit()

Is the text edit multi-line aware?

Public function Virtual Const

bool

 

IsTextPassword()

Is the text displaying a password and should be obscured?

Public function Virtual Const

bool

 

IsTextReadOnly()

Is the text currently read-only?

Protected function Virtual

void

 

OnCursorMoved

(
    const FTextLocation& InLocation
)

Called when the cursor is moved within the text area

Protected function Virtual

void

 

OnTextChanged

(
    const FText& InText
)

Called when the text has been changed by an edit operation

Protected function Virtual

void

 

OnTextCommitted

(
    const FText& InText,
    const ETextCommit::Type InTextActio...
)

Called when the text control has committed its current edit changes

Protected function Virtual Const

bool

 

ShouldClearKeyboardFocusOnCommit()

Should we clear the keyboard focus when the user commits text to this widget?

Protected function Virtual Const

bool

 

ShouldClearTextSelectionOnFocusLoss()

Should the text clear its selection the widget loses focus?

Protected function Virtual Const

bool

 

ShouldJumpCursorToEndWhenFocused()

Should the cursor be jumped to the end of the document when the widget gains focus?

Protected function Virtual Const

bool

 

ShouldRevertTextOnEscape()

Should we revert the text back to its original state when the user presses escape?

Protected function Virtual Const

bool

 

ShouldSelectAllTextOnCommit()

Should we select all text when the user commits text to this widget?

Protected function Virtual Const

bool

 

ShouldSelectAllTextWhenFocused()

Should the text be selected when the widget gains focus?

Protected function Virtual Const

bool

 

ShouldSelectWordOnMouseDoubleClick()

Should we select word on mouse double click?

Protected function Virtual

float

 

UpdateAndClampHorizontalScrollBar

(
    const float InViewOffset,
    const float InViewFraction,
    const EVisibility InVisiblityOverri...
)

Called when the fraction and offset of the horizontal scroll area has been recalculated.

Protected function Virtual

float

 

UpdateAndClampVerticalScrollBar

(
    const float InViewOffset,
    const float InViewFraction,
    const EVisibility InVisiblityOverri...
)

Called when the fraction and offset of the vertical scroll area has been recalculated.

Classes

Name

Description

Public struct

FArguments

Typedefs

Name

Description

FOnCursorMoved

Called when the cursor is moved within the text area