Skip to content

[Control] Button Text Overflow when Assigning by Script #97355

Closed
@Delsin-Yu

Description

@Delsin-Yu

Tested versions

v4.3.stable.official [77dcf97]

System information

Godot v4.3.stable.mono - Windows 10.0.17763 - Vulkan (Forward+) - dedicated NVIDIA GeForce RTX 4060 Ti (NVIDIA; 32.0.15.6109) - AMD Ryzen 9 5900X 12-Core Processor (24 Threads)

Issue description

The text will overflow when assigning the text property in the script.

image

Steps to reproduce

  1. Create a new project
  2. Create an empty Control scene, save it to a file, and mark it the main scene
  3. Attach the MRP script to the root node
  4. Run the scene

Minimal reproduction project (MRP)

extends Control

func _ready():
	var btn := Button.new();
	btn.text = "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.";
	btn.autowrap_mode = TextServer.AUTOWRAP_WORD;
	
	var vbox = VBoxContainer.new();
	vbox.add_child(btn);
	vbox.set_anchors_preset(Control.PRESET_FULL_RECT);
	vbox.alignment = BoxContainer.ALIGNMENT_CENTER;
	
	add_child(vbox);

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions