Event Dispachers with dynamically created buttons

I have created an UI, which has a grid full of dynamically created “notes”. The text for these notes is taken from a separate .txt-file with C++ (which works, no problems there).

My problem is when I’m trying to create a system where you can press a button to choose one of these notes and get the text stored in that particular note.

I’ve done the grid in the main UI and have separate Widgets for the Vertical box (W_VerBox) which stores the note (W_Note) and button (W_Button).

I also tried a version where the button was in the same widget as the note, but then the Event dispatcher only took the text in the first note (first string from the StringArray), which doesn’t work either in my case.

When the W_LoungeService is first constructed (Event construct), it takes all the different “notes” (Strings in an Array), goes through them and creates a W_VerBox for every required grid slot (the amount of the strings in the array). Code →

In W_VerBox the vertical box is initialized (Event on initialized), it creates a note (W_Note) and button (W_button) widgets, adds them as children to the vertical box and binds an event to the button (Call ED Reply). (At first I used “Event on Construct”, but that worked even worse, the notes didn’t have text from the .txt-file, only “This is text text”, which is set as a default value. If I added only the event dispatcher binding to the construct-event, I get error “W_Note not found”, so that doesn’t work either.) Code →

The button widgets code just has (another) event dispatcher, which is sent to the main UI.

Here’s the images of the UI, with and without the “notes”:

SO… In short, how can I correcly connect event dispatchers to dynamically created widgets (buttons in this case)? Is this idea doomed to fail, or is there any way to make this work…

Thank you in advance for all the help.

you dispatcher looks fine, what you can do though is in the dispatcher return a ref to the widget that was clicked and then pass that directly to your CreateReply