UI - How to Auto Focus On A Widget Below The One You Just Closed?

Hello there
I’ve been wondering as the topic says, how do you focus to the widget below the one you’re closing?
Example such as:
Say you have open a sub menu from the main menu, the sub menu is on top of the main menu, and I set focus on the sub menu. But in order to use something like “On Key Down” function on the main menu after closing the sub menu, I need to re-focus back to the main menu. However after the sub menu was the one that was focused on, after it’s closed, the focus is gone, and “On Key Down” won’t be available on the main menu anymore.
Is there a way to do this properly (Being able to close the sub menu and focus back to the main menu that’s below it)?
Thanks in advance !!!

It’s a matter of calling set keyboard focus on the desired widget. You either need a reference to the main or, better, have the sub-menu Event Dispatch its dismissal to the main (that created it, right?).


Another way of handing it all is with Enhanced Input. You can juggle Input Mapping Context priority.

1 Like

Oh yeah, the event dispatcher might be a good idea. Thanks for mentioning that!
I think I worked too much today and my brain just slowed down and become stupid… lol

1 Like