So as the title says I’ve been trying to add different versions of the same widget to a scrollbox.
I did this with creating the same widget multiple times with a loop and adding it as a child each time with different data. This works fine.
The problem: Each widget has a button, with this button I want to add the content of that specific widget to an array that is in a different blueprint, but for some reason, I can’t. I add the data to the array in the widget blueprint but when I try to access the array elsewhere there is nothing in it.
I also tried it with simple variables but it seems like I can’t get any data out of these widgets to other blueprints.
Any reason why this happens? And what could be the solution?
Any help would be greatly appreciated.
(I can provide pictures of the blueprints if needed)
In this widget when I press a button I create the other widget give it a random value and add it to a scrollbox.
At the end I get something like this:
After this in the second widget on a button press, I try to change a variables value to the current widget’s value. (for example clicking the button on the first purple box should change the value to 7)
This variable is declared in the first widget blueprint.
I’m a bit confused. Not sure what your intentions here are but in the first picture, you’re extracting just the canvas from the TestWidget2 and move it to the scrollbox, leaving an orphaned and canvasless TestWidget2 behind…
Perhaps you want to add the entire widget as content to the scrollbox instead.
I create a W_Scrollbox widget and add 10 children to the scrollbox inside, each with a randomised Int. I then pick one at random and read the data inside. This works fine.
Perhaps you’d like to describe what you’re trying to create, I might be able to push you gently in the right direction. I mean the high level stuff - what the end user is supposed to with it.
I will try your solution when I get home, and tell you if it helped.
By the way the end product supposed to be a list of randomly generated “people”, and the user would be able to put selected “people” into a different list. Like there are avaible workes and you can hire them.
I’d then have a JobBoard widget with 1 list containing Persons widget and additional jobs lists (scrollboxes, right, ideally separate wigets) waiting to be populated.
AddChild (existing Person widget from JobBoard) to a Persons List should automatically reparent the Person from one list to another. This way you do not need to worry about making copies of the person (unless it is desired, of course.
Let me know if you’re having issues with setting this up.
Sorry for the late reply I could only try what you suggested today.
I replicated your blueprint and it works perfectly (thank you so much for that!) but the problem is that I can only get data out of the child by giving the index of it. How do I get the data out of the child with a button?
No problem, let me know if there’s anything unclear.
The list selection by double clicking is hard-coded. I wouldn’t do it like this normally. A much more sensible approach (especially with multiple lists) is to have them as separate widgets, with their own dispatchers and use the main JobBoard as a communication hub.
Anyway, this is a stub of something, hopefully it’s useful.