[Discontinued] UMG Rich Text Box

Hi!

Thanks for making this plugin.
It worked perfectly in the editor (4.11). However, I couldn’t get it to work in any kind of packaged build (it is not appearing at all, no error messages).
The project is c++.
I already Generated Visual Studio project files and built it from Visual Studio.
Right after I dropped the plugin in the project’s folder and opened the uproject, it asked me to build the plugin and I did - it worked fine.

What can I do to make it work?

Thanks!

Any chance you can compile this for 4.12?

Are there any news on this? I can’t seem to get it to work on 4.12.5 - it shows the text as regular text, including the markup.

Any idea how you make ‘Span’ work in C++ and not via UMG? E.g, the following doesn’t work due to the extra pair of quoteS:



	FFormatNamedArguments TextArgs;
	TextArgs.Add(TEXT("SpeakerCol"), FText::FromString(TEXT("<span color="#ff0000ff">")));


Trying to create the text string in code… anybody?

EDIT: Got it to compile by adding backslashes before the extra quotes. However, adding markup doesn’t work it seems :confused: Example:

EDIT: ARGH 2.0 - got it working, had the formatting wrong. Final result:



	UBZGame_RichTextBlock* NewRichText = NewObject<UBZGame_RichTextBlock>(this);
	ASSERTV(NewRichText != nullptr, TEXT("Unable to create new Rich Text Block"));

	// Can be static const
	FFormatNamedArguments TextArgs;
	TextArgs.Add(TEXT("PlyBreak"), FText::FromString(TEXT(": ")));
	TextArgs.Add(TEXT("PlyrColour"), FText::FromString(TEXT("<span color=\"#ff0000ff\">")));
	TextArgs.Add(TEXT("MsgColour"), FText::FromString(TEXT("<span color=\"#ff00ffff\">")));
	TextArgs.Add(TEXT("FormatEnd"), FText::FromString(TEXT("</>")));
	TextArgs.Add(TEXT("PlayerName"), FText::FromString(Message.Sender->PlayerName));
	TextArgs.Add(TEXT("Msg"), FText::FromString(Message.ChatMessage));
	
	// Build 'marked up' message
	const FText FinalText = FText::Format(LOCTEXT("FinalText_Key", "{PlyrColour}{Msg}{FormatEnd}"), TextArgs);

	NewRichText->SetText(FinalText);


Try using



FText::FromString(TEXT("<span color='#ff0000ff'>"));


,
that should work!
To anybody else, I’ll work out an update for 4.12.5 and post it here soon!

There are some problems with this plugin like it is: I installed it, everything worked, but on editor restart, the editor shows errors that Rich Text Box script is not found. When I went to my HUD blueprint - all text was gone! Also, as it was noted above, plugin is not displayed in the packaged build (I actually could see errors in the logs while packaging that something related to URichTextBox is not found). I tried to add a reference in build.cs file, but it did not help, in fact, I was getting other errors, and on editor restart it could not open my project at all…

So, this is how I finally made it work (4.13 preview 2, it also works in a packaged build, and on editor restart):
(My base project is C++)

  1. Do not use the plugin like it is. Instead, create a new C++ class RichTextBox inherited from Widget.
  2. Copy everything from plugin’s RichTextBox.h/.cpp to our RichTextBox.h/.cpp
  3. Compile, Enjoy :cool:

The type should be set to Runtime in .uplugin otherwise it will break in packaged builds.

runtime.png

It’s not specifically due the plugin it self. I had issue with the WebBrowser plug-in for exactly the same issue. I raise a issue for this : UMG WebBrowser - failed to load - UI - Epic Developer Community Forums

When I first seen this thread I thought this was exactly what I was looking for. I got it added to my project and it works fine.
When I started looking into the RichTextBox code I first thought adding images would be as simple as adding an ImageDecorator to the list of Decorators for the widget.
Unfortunately it seems a little more involved and I can’t quite wrap my head around how to add ImageDecorator support to the RichTextBox class.

Anyone have any thoughts?

Anyone had any more progress with this, regarding images in RichTextBoxes?

Did you ever make a 4.12.5 version?

Hello!

Can you please clarify the license of this plugin?
Is this distributed under a complete free license, or has any restrictions?

Thank you.

I’ll try to implement images in the boxes, and report it here!

Unfortunatelly not, due to time issues on my side, but I’ll catch up and update this to 4.14.2 somewhere around next week.

It is completly free, you can use it for whatever you prefer :slight_smile:

Hey, thanks for the plugin @iUltimateLP!

I’ve made a few fixes here:
RichTextBox.h
RichTextBox.cpp

  • Added shadows back in (though they don’t seem to work with <span> text)
  • Fixed depreciation errors
  • Reordered/renamed some things to make it more similar to the normal TextBlock

Also as @Flash7 pointed out, you can just put these files directly into your project and change the class API/header to your project, much easier than dealing with a plugin. (I couldn’t get the plugin working)

Edit: I looked deeper into the RichText code and it seems to only support these tags: Span, Size, Style, Color, and Font. So sorry for those who wanted inline images, looks like they’re not supported in any way.
Also it seems like RichTextBlock doesn’t support changing color at runtime. Any ideas on how to solve this?

Sure it is easier to use those files in the project, but I made the plugin mostly so Blueprint-only users can have the RichTextBlock :slight_smile:

About the Images, I’m pretty sure that there’s a way of implementing images between text. Have a look on the Slate Test Suite (available at the developer tools), there they did it. Unfortunatelly I don’t have time - again :confused: - to mess with it, but have a look at STestSuite.cpp (Engine/Source/Runtime/AppFramework/Private/Widgets/Testing/STestSuite.cpp), thats where they implemented all the tests.

About the line breaks, in UMG try to hit Shift+Enter, that should add a new line. If you want to do that from blueprints, you probably need to append the string/text with a Shift+Enter in a text input field :smiley: Kind of hacky, but it works!

@iUltimateLP! do you have any new version about this UMG Rich Text Box?I make a c++ code type based this plagin,but when i try to add a hyperlink func,i jamed…i saw the multi-colored function is implemented by SRichTextBlock,just call “SetText"func and get a FString with stardand color code like “<span color=”#ffffffff”>Text</>",but i can’t find how/where to analysis"span color=",and don’t know how to add a hyperlink decorative words…
I find STestSuite file,but is a little difficulty to my c++ skill… PS:i’m using 4.14

The plugin is not compatible with 4.15.
Can you please update it?

This plugin works great in PIE and Standalone but stops working when running the packaged application, any ideas? (4.15)

Hi. Plugin it’s very usefull.
But I want to change the format you specify.( “span” )
Plz Let me know how to change it…:((…!!!

It’s works!
FText::FromString(TEXT(“<span color="#ff0000ff">This</>”));