Can you refresh a parent widget from 2 widgets deep?

Only about 10 days into using Unreal so still learning but here is my issue!
So I can post screenshots if needed. But basically I have an inventory screen that creates inventory slots (another widget) inside a wrap box when pulled up. Then another popup widget can be called by clicking an item and then they can use the item.
Is there a way to refresh that inventory after an item is used to display the decreased item number? I can remove the top level widget and then re-create but I feel like it shouldn’t need to flicker off and back on the screen just to update the slots.
Is there some way to interact with an event in the top level widget from the popup widget?

1 Like

Using Event Dispatchers is the usual way - when you want a child talk back to the parent. The chain can be deeper, it’s a matter of referencing.

  • if wBlue widget creates the wBlack, whenever black calls a dispatcher, the blue will know:

  • it works for deeper structures, too; wBlue has 2 wBlack widgets, black widgets have children of their own:

Even though wBlack and wBlack1 do not about each other’s existence, wBlack can call a dispatcher and SomeOtherWidget inside Black1 will receive the call.

It can be either a Function (with no return) or an Event on the receiving end. Signatures must match - the dropdown above can create an event / function automatically, and with the correct signature; handy if you need to pass a lot of data types.


  • and finally, for non-dynamically created widgets, if wBlack is a direct child of wBlue, black can talk to blue like so:

1 Like

There’s more than one way to organise it, here’s one:

  • this is my slot:

image

Above, when a button is clicked, we dispatch the responsible slot and / or a bunch of data.

  • the inventory creates the slots, and binds the dispatcher:

In this case, it’s the inventory’s job to create popups and use items. Perhaps there’s no need to have this script duplicated in all 96 slots… The inventory is a manager class after all.


And if you need to Use Items in some other, unrelated blueprint:

You just need an event / function in that blueprint that can receive the call.

1 Like

Thank you so much! I found where I screwed up. I was passing down the parent widget in a variable as a generic widget class instead of as the specific widget with the event dispatcher so it wasn’t able to call it.
Still learning but this will make things easier!

1 Like