it’s true, you can’t create a custom event within function but the checkbox should have it’s own event which fires when the selection changes, right?
You could start by creating a custom widget (probably you have one already), you make in this widget an integer variable which is editable and exposed when the widget is created. Next on Event construct, you run a loop that adds as many widgets to the scroll box as you need (create widget → assign array index to the integer variable, repeat x times). In the custom widget of yours, you could listen fo the checkbox selection change event, when it happens, return the int value or do something with it as the int value in every widget represents the location in the scroll box.
Ok so i’ve been trying to create a simple menu and after some time researching the internet (gotta say the documentation lacks alot of info) i’ve been able to do a basic interface. The problem is: i’m creating the widgets into a scroll box and then i’m trying to bind the event of selecting the check box of it by binding a custom event like this:
But the event doesn’t save the index from the loop so it’s always the last index. There is no way to identify which check box i clicked. I tried creating a function and maybe there the stack would be conserved but i cannot create a custom event inside a Blueprint function. Any help would be appreciated.
I think i understood. I already tried to assign an integer to identify the checkbox but then i could not get a reference to that checkbox. Is there anyway to pass more arguments to the event node so i could get a reference to the object? Or is there a way to retrieve the object associated with the event?
What are you actually adding to the scroll box? only several checkboxes or do you have custom widget which have like a text and checkbox or other stuff?
If you have a custom widget, you could listen for the checkbox selection changed event, when this events fires, you call a function, like a function of your character BP, and to this function you provide the integer value. The integer value represents the widget location in the scroll box.
The SaveSlot Widget has no Blueprint Script. I was trying to do all from the PlayMenu Widget since I have no clue how to get a reference to it from the SaveSlot. Your suggestion seems pretty good. You need only to show me how to get the reference to my menu widget from the slot widget. Thanks for the help!
Here is an example how your SlotWidget could look like (it must have a blueprint, maybe you can’t see it, let me know). You have an Int variable and a reference to the parent widget, both editable and exposed on spawn.
And this is how you add slots in the parent widget. You provide the int as location in the scroll box and the parent reference to get to the custom function. The function “YourFunction” is a function of the parent widget, there you take the int, and use the number in it to get the child of the scroll box located at that index.
Wow its working! Thank you very much for the help! I got started not long ago with the engine and these little things drives you crazy. One less think to worry about! Thanks alot.