tcla75
(tcla75)
August 17, 2018, 1:19pm
15
Everynone:
So you want to replace the button + image with another widget? Kind of tricky.
The main problem is that your wrap box does not contain user widgets - you used a button + image. Those 2 should be wrapped in a separate widget - rather then replacing them with a new widget, you could update the existing widget. You can still do it with your setup but do not insist on replacing the wrap box’ slot with another button+image or another widget. The reason is below.
You cannot insert objects into UMG panels the way you insert data into arrays, you can only add at the end. If you wanted to exchange image 4 out 10, you would have to clear the panel first and then repopulate the whole thing. This also requires extra sorting and keeping track of the indexes - it’s not particularly difficult, but it’s annoying.
My advice here would be to wrap the button + image combo into a separate widget and populate the wrap box with those. The user widget can then have an onClick event that pulls an image out of whenever you want and update itself. [HR][/HR]This is all *assuming *(again) that every widget in the wrap box is of the same class.
Ahh I can see where the misunderstanding is coming from. I’m not trying to replace the image and button with another widget. I’m trying to replace the widget with another widget. The button would just fire that event. I want it to switch it to a whole new widget entirely is that possible?