Download

Dynamic On Check State Changed Event - Reference to ToggleButton

*Note:The UE4 Widget .uasset file can be found at the bottom *
Background Context:
I have multiple “groups”. the names of these “groups” are stored in an string array called “Groupnames”. For every “group” there is a further strin array containing the names of the subitems of these groups. These string arrays got combined to a CompositionGraphCapturePasses Array so i have an array containing the “Groupitem” Arrays. this CompositionGraphCapturePasses Array is named “Groupitems”

What i want to do:
Generate a List (Verticelbox) inside a widget containing.

  • a Horizontal Box with a TextBlock for the name of the “group” and a Toggle Button
  • a Vertical Box containing the “Groupitems”
    and then the same for the next group and so on.

The Toggle Button should toggle the visibilty of the Vertical Box containing the “Groupitems” between visible and collapsed.

The creation of the list works well. But i have Issues regarding the OnCheckStateChangedEvent of the Toggle Buttons.

In this picture below you can see the generated list. I marked the Toggle Button and the associated Verticle Box in the same colours.

The problem:
Every Toggle Button Toggles the Visibility for the last Vertical Box (In the Picture marked in red)
This probably happens because the they are all using the same Vertical Box reference. To Avoid that i tried to Store all the Vertical Boxes into an Array (called VB_Groupitems) so I could refere to them using the index of the group to get a reference to the Vertical Box stored inside the Array. And that works for choosing one constant index but if i try to give him multiple values the used index is just again the last Index.

In the next 2 pictures you can see the Blueprint i am using at the moment.

What i need:
So what i need is a solution that allows to indentify what of those buttons is Clicked in the OnCheckStateChangedEvent, so i could set the index of the VB_Groupitems based on that. In the Picture below i will try to visualize what i mean.

**I have no idear how to solve that.
So thanks in advance to everyone who would help me! **

Attachment:
The links to the Full resolution pictures used above. (Sorry for that kind of links but it was an easy way to get permanent links, by just sending the files into a discord channel)
List: https://cdn.discordapp.com/attachmen…4/question.jpg
Blueprint part 1: https://cdn.discordapp.com/attachmen…/question2.jpg
Blueprint part 2: https://cdn.discordapp.com/attachmen…/question3.jpg
Solution Concept: https://cdn.discordapp.com/attachmen…/question4.jpg
Blueprint Widget: https://cdn.discordapp.com/attachmen…04/Test.uasset

Add an another input in your event dispatcher of type your checkbox, on clicked pass the reference with the booolean.
Then GetChildIndex of this reference should return the right integer.

FIrst of all thank you verymuch for your answere. Tried to adapt what you said, but it does not work. so i probably made something wrong.I atteched a screenshot of what i made to this reply.
I would very appreciate your ongoin help!

You must create your own Widget add a CheckBox in it. Then you can create your own event dispatcher that will not only return a boolean but also a reference to self :

Then you will be able to suscribe to it :

Of course you will have to construct or create a W_MyCheckBoxWidget and not a base CheckBox for this to work.

Thank you very much got it working now!!!