Skip to main content

Multi-Line Text Box Canvas Item

Base:
struct
Type:
FNMultiLineTextBoxCanvasItem
Header File:
NexusUI/Public/CanvasItems/NMultiLineTextBoxCanvasItem.h

A canvas-renderable text box that holds an ordered list of small / large text lines, per-line colors, and a current severity level. Intended for HUDs, developer overlays, and diagnostic readouts that need to be drawn directly via FNCanvasUtils::DrawCanvasTextBox without the cost of Slate / UMG.

The struct owns its own dirty flag, severity tracking, and on-demand measurement pass — callers just push lines, set severity, and ask FNCanvasUtils to draw it.

Adding Content​

/** Append a small-font line in the supplied color. */
void AddSmallLine(const FText& Line, const FLinearColor Color = FLinearColor::White);

/** Append a large-font line in the supplied color. */
void AddLargeLine(const FText& Line, const FLinearColor Color = FLinearColor::White);

/** Clear every line, reset severity to Message, and restore the default border / background colors. */
void Clear();

Each Add*Line call sets the dirty flag — FNCanvasUtils will re-measure the box on the next draw if any line has been added or modified since the last paint.

Severity​

Severity drives the border color of the text box and is meant to be aggregated from many sources over a render frame. Set the value explicitly when you know it, or use AddSeverity to monotonically raise it as more serious lines are appended.

/** Set the current severity and update BorderColor accordingly. */
void SetSeverity(const ENSeverity Severity);

/** Raise the current severity only when New is louder than the cached level; no-op otherwise. */
void AddSeverity(const ENSeverity Severity);
SeverityBorder Color
InfoDark grey (FNColor::GreyDark)
MessageLight grey (FNColor::GreyLight) — default
WarningYellow
ErrorRed
FatalPink (FNColor::Pink)

State Queries​

/** True when the box has any lines. */
bool HasContent() const;

/** True when content has been added/modified since the last successful draw. */
bool IsDirty() const;

Drawing​

The struct holds private layout state and is rendered via the friend class FNCanvasUtils:

FNCanvasUtils::DrawCanvasTextBox(&TextBox, Canvas, TopLeftPosition);

DrawCanvasTextBox re-runs the internal measurement pass when the box is dirty, then draws background, border, and each line at the correct offset.