How do I properly implement CommonUI custom back input action for widgets?

In common UI you push widgets to stack, then pop them either with a button or “back” action (typically escape). I want to pop widgets with custom actions, like inventory should be opened AND CLOSED with “I” button, player list with “P”, etc.

How do I properly set this up? I seriously couldn’t find anything about it. I’m using EnhancedInput.

So I don’t know about EnhancedInput since I’ve not used that before, but with CommonUI the only solution I could think of is to

  1. Add an input action to your data table for each widget (e.g. ‘I’ for ‘Close_Inventory’, ‘P’ for ‘Close_PlayerList’, etc.)
  2. Create a button class/blueprint based on CommonButtonBase
  3. Place the button in your widget
  4. Set the button’s triggering input action to the respective input action
  5. Deactivate the widget on button press
  6. Make the button invisible
1 Like

I ended up adding a property “CustomBackAction” to a subset of UCommonActivatableWidget and registering handle back action to it. Doesn’t seem to be fully functional in 5.2 but 5.3 promises full Enhanced Input support, so until then, I guess.

Thank you ! It’s solved my problem !

1 Like