Create a new Widget inside editor utility: Why won't this work?

Hi I’m trying to read an array and then create a button for each member in the array. Now I understand this needs to be done by creating widget inside the main widget. I’ve tried to copy an example but it just doesn’t seem to work.

This is the script that I’m using:

At the moment I just want to know how to create one button for each entry in the array. I’ll try and figure out how to alter them afterwards.

The widget I’m trying to add is very simple and looks like this:

291210-button.png

I know the clear child works. I tried removing the for loop and it still didn’t work. I think it has to be the create widget that I’ve got wrong.

Thanks guys.

I presume they are created on top of each other, if you want them to appear next to each other you could use, either an offset in the canvas panel, a grid position in a grid panel, or a horizontal/vertical box.

I’m not sure what “RoomsScrollBox” is. Make sure you add the children directly to the panel/box they should appear on.

Hi Crisp Clover thanks for responding.

Unfortunately I don’t think it them creating on top of each other, firstly not one is appearing. RoomScrollBox is a Scroll Box. It works similar to a vertical box. It work fine if I test with just buttons. It’s the importing widgets I’m having trouble with.

I can’t see the scroll box in the widget hierarchy. Are you creating the scroll box dynamically?

Just tested in on my end and I can’t seem to replicate the issue.

  • Have you verified that your Array actually has content when you’re trying to read from it?
    Try connecting a PrintString-node to the Loop Body of the ForEachLoop so that it prints a string for every element in the array. If nothing shows up the array is either empty or the ForEachLoop is never run.

  • Where is the Array situated in relation to the widget?

It’s a old topic, but I ran into the same problem.
I can add child widget in editor world,
But when I run the project (PIE), It won’t work.
Anyone knows what happend?
Thanks…