Adding LineEdit Fields Dynamically

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

I’m trying to dynamically add LineEdit fields to my ui so that users can enter additional properties. This is what the scene looks like:

enter image description here

enter image description here

Here is the code attached to the “Add Property” button:

func _pressed():
	var labelProp =
	labelProp.text = "Property"
	var lineProp =
	labelProp =
	labelProp.text = "Property Value"
	lineProp =

When I click the Add Property button this is what happens:
enter image description here

What can I do to get the LineEdit fields properly added?

:bust_in_silhouette: Reply From: Ghostrix98

I believe you need to call add_child on $VBoxContainer. Like so get_parent().add_child(node) because the script is attached to the button.

That was it thank you so much!

deepseaprincess | 2021-10-12 15:45