Change a text widget dynamically

As the title mention, I want to click a button to add the scroll box.
The scroll box is successful, but I don’t know how to let the text show in the scroll box can display the row number.
Like this figure:

Hello 1, Hello 2, Hello 3…
I know I should use the Get Children count, but I still fail.

Please help me, thanks for any suggestions.

@Everynone Sorry, I stuck agin. :frowning:

Looks fine, grab a text block and set its text. Or, the way I’d do it:

• Expose a text variable on spawn in the user widget you create dynamically, make it Instance Editable
• in the same widget’s Construct, set the text block’s text using that variable
• when a widget is spawned, feed it text via the exposed text var


Yes, I grab SetText. But I don’ know why it doesn’t display.

I guess the problem is this two are separate user interface.

I try in only one user interface.
The result like this figure:
Only the top widget show the text and the number has changed.

But my idea condition is hope that W1 W2 W3 W4 from the top to bottom.

You іуе text to the first only widget each time. You should do this with the newly added widget. Create a set text function in your custom widget and call it after the widget is created.

How can I do this part?
Use custom event?

How do I focus that newly added widget? After Add Child?

Create a text var in your custom widget and make it exposed:

then pass the desired text with CreateWidget node:

1 Like

Another way:

Create set text event:


call it after creating your widget:


I try this way. Still fail :frowning:
I have two question.
Where I define my text content? Is there? So I don’t need to add a new input in custom event, right?
Second question, I can’t connect in there.

You should create the event inside your ScrollTestContent widget.

1 Like

You just build one user interface file, right?
But if I don’t want to add the whole content to the scroll box.
How can I do?

My original method have two user interface file.
One is Mainfile, it contain scroll box panel.
Another is the content, which I want to add to the scroll box.
What can I do?

I made two widgets:


Thx! I solved this problem.
Thank for you let me keep thinjing!
Super appreciate. You are really kind.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.