How to get specific button clicked in a scroll box?

A cleaner way of doing this would be to handle the Text setting in the Button widget itself (the one you are adding to the scroll box). The button widget could have one variable attached to it called ChickenStruct or something. Make sure though, that it is set to public and Expose on spawn is also checked. That way, when you create the widget with the CreateWidget node, it will have an extra input looking for ChickenStruct data. On your button Widget you can have the logic for setting the text. That way each button will have its own ChickenStruct data to access. If you need to ever get back to the parent widget, you can when you use CreateWidget Bind the OnClicked event to a custom event. Example of what I mean below:
ChickenListWidget

ChickenButtonWidget: This is a bound function to get the text for the button itself.

When the button was clicked we call the event dispatcher:

2 Likes