Hi guys,
I’m trying to use the new CommonUI input system, and specifically the RegisterUIActionBinding to handle inputs from UI, but if I set the focus to an editable text when the input is pressed, the key pressed goes into the textbox, even if the input should be handled, so it should not get to the editable text.
I.E. My key is Y, but if I press Y, I see the y character inside the editable text, from my debug I found that SlateApplication ProcessKeyChar event is called after the ProcessInput function of CommonUIActionRouterBase.
This is the code of what I’m trying to do:
UE_DEFINE_GAMEPLAY_TAG_STATIC(TAG_UI_ACTION_OPENCHAT, "UI.Action.OpenChat");
UMyCustomWidget::UMyCustomWidget(const FObjectInitializer& ObjectInitializer)
: Super(ObjectInitializer)
{
}
void UMyCustomWidget::NativeOnInitialized()
{
Super::NativeOnInitialized();
FBindUIActionArgs Args = FBindUIActionArgs(FUIActionTag::ConvertChecked(TAG_UI_ACTION_OPENCHAT), false, FSimpleDelegate::CreateUObject(this, &ThisClass::OpenChat));
RegisterUIActionBinding(Args);
}
void UMyCustomWidget::OpenChat_Implementation()
{
if (MyInputBox)
{
FInputModeUIOnly UIInput;
APlayerController* PC = GetOwningPlayer<APlayerController>();
if (PC)
{
PC->SetInputMode(UIInput);
MyInputBox->SetFocus();
}
}
}
MyInputBox is a UEditableText object.
I tried to dig inside the CommonUI input code (CommonUIActionRouterBase for example), but without luck (the code doesn’t have good comments at the moment, especially CommonUIActionRouterBase, and the docs about CommonUI are completely generic and don’t cover all the CommonUI functionalities deeply).
Thank you in advance!