Correct usage of RichTextLabel in C++

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By StateOff
:warning: Old Version Published before Godot 3 was released.

I would like to use RichTextLabel from a constructor of a dialog.

I tried many combinations, for example:

RichTextLabel *lbl = memnew(RichTextLabel);
container->add_child(lbl);
lbl->set_bbcode(“Something with [color=aqua]color[/color]”);

However no text shows at all.

I can see that there is a check for is_inside_tree in set_bbcode.
Can someone elaborate?

As BBCode is not enabled in RichTextLabels by default, you need to set its bbcode_enabled property to true. This is a bit strange, but that’s how it is.

Calinou | 2018-01-15 00:30