Download

How to use Decorators SRichTextBlock in Slate?

Hello, I’m writing the full UI of a game purely in Slate, but now I’m stuck, because I can’t get the SRichTextBlock to work with image Decorators, I just can’t figure out the workflow to create/get the image decorators with slate. Any advice(?)

I posted this question in AnswerHub too, (https://answers.unrealengine.com/que…0788/view.html)
But because I rarely ever get any responses relating C++/Slate there, so I’m trying here too.

Tthe Rich Text Block Styles were no problem, solved it like this:



StyleInstance = MakeShareable(new FSlateStyleSet(TEXT("RichTextStyle")));

for (const TPair<FName, uint8*>& Entry : GlobalStyle->RichTextStyleSet->GetRowMap())
{ FName SubStyleName = Entry.Key;
FRichTextStyleRow* RichTextStyle = reinterpret_cast<FRichTextStyleRow*>(Entry.Value);

if (SubStyleName == FName(TEXT("Default")))
{
  [INDENT=2]DefaultTextStyle = &RichTextStyle->TextStyle;[/INDENT]
  }

StyleInstance->Set(SubStyleName, RichTextStyle->TextStyle);
 }

TSharedRef Marshaller{ FRichTextLayoutMarshaller::Create(CreatedDecorators, StyleInstance.Get()) };
SNew(SRichTextBlock)
.Text(FText::FromString("<Default>Test</><Test>Smaller</><img id=\"Logo\"></>"))
.TextStyle(DefaultTextStyle)
.Marshaller(Marshaller)


Any hints/tips on how to create/use SRichtTextBlock and Decorators without UMG etc. are appreciated :slight_smile:

Hmm, bumpedy bump.