I have my inventory that opens/closes when i press tab, but when i click on one of the slots and press tab to exit the inventory, it isnt exiting, but selecting the next button. How can i prevent it?
It is due to the navigation functionality for widgets, which you can only de-activate by completely disabling keyboard focus support all together. You could either listen to the OnPreviewKeyDown event or close the menu from the controller instead (using an input event).
I cant find this OnPreviewKeyDown
You can override the function in any UMG widget. I.e. go to the graph of an umg widget and click override in the left panel.
hello, do you solve this question?
Can you help me?
Thx!!!
Leaving this for other people that may be looking for the answer. it’s fairly easy to do in C++.
FNavigationConfig struct in the Slate application controls which keys are responsible for UI navigation.
To simply turn off tab navigation, follow the code below.
#include "Framework/Application/NavigationConfig.h"
#include "MyGameStateBase.h"
void AMyGameStateBase::BeginPlay()
{
Super::BeginPlay();
FSlateApplication::Get().GetNavigationConfig()->bTabNavigation = false;
}
You may also make Your own NavigationConfig by subclassing FNavigationConfig, if You want more control (like dynamically turning the nav on/off)