How can I add a multiline label text in a tree?

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By GermanPotatoHC

I want to create a newsletter running in a UI tree
But when I add it with “subchild1.set_text(‘description’)”, then the text is without any breaks.
So I had the idear to add a text element in the tree. But I dont know how to do this.

extends Tree


func _ready():
    var tree = self
    tree.set_hide_root(true)

    var root = tree.create_item()
    root.set_selectable(0, false)
    var child1 = tree.create_item(root)
    child1.set_text(0, "Version")
    child1.set_selectable(0, false)
    var child2 = tree.create_item(root)
    var subchild1 = tree.create_item(child1)

    var Text01 = Label.new()
    Text01.text = "Description"
    subchild1.set_custom_draw(0, Text01, "")

    subchild1.set_selectable(0, false)

func _process(delta):
    pass

So if anyone knows how to take a multilined text in a tree, maybe with Autowrap Mode and expanding horizontal without bugging out of the tree, answering me please :wink:

Thank you in advance

PS: Sorry for the bad english

Do you mean to add text with line-breaks perhaps? e.g.

Text01.text = "Hello\nWorld"

Two lines (“Hello” and “World”) will appear in the label.

spaceyjase | 2023-05-19 11:04