Cleanest way to get right click even to a UMG widget?

I have the following UMG widgets:

  • PDA
  • InventoryGrid
  • InventorySlot

The PDA can have zero, one, or two InventoryGrid widgets, and the InventoryGrid widget can have one or more InventorySlot widgets. Ideally, I’d like my InventoryGrid widget to cleanly listen for a right mouse button event.

Right now, I have my player controller listening to the RMB via a custom input mapping. If the PDA is open, I want to sent the RMB to the PDA to handle, otherwise I do some other gameplay logic.

However, I don’t know how to cleanly do this. Somehow I need the PDA to know whats under the cursor and send it an event depending on what it is. If its an InventorySlot widget for example, the PDA widget should send it a DropItem event.

Any thoughts on how to do this cleanly?

Also if I have too, I thought it’d be fine for the PDA to notify all children when it receives a RMB click, and the children could just check if the mouse was in the widget and act accordingly. A bit more work and duplication but doable. However, I’m not sure how to notify all children of this?

Why not just have some sort of Boolean that says if it’s open or not. Then when you want to drop an item or something by right clicking, check if were in that PDA mode, if we are then drop it. If not, then do something else

I guess you can just ‘not handle’ the event and let it pass through to the next widget. Like, if you have three widgets on top of each other and you click with right mouse button on the one on the top you can check in the OnMouseButtonDown event that it was a right button, then do your logic and just send Unhandled to the output so that the widget underneath it (theoreticaly) can now receive this event.