-
Have you indicated all the correct parameters in the GetFileName() function? They should be
GetFileName(const FText& Text, ETextCommit::Type CommitMethod)
-
Have you marked GetFileName() as UFUNCTION() ? Without it, AddDynamic will fail.
In any case, here’s my test, and it works:
.h
UPROPERTY(meta = (BindWidget))
UEditableText* EditableTextName;
UFUNCTION()
void Committed(const FText& Text, ETextCommit::Type CommitMethod);
.cpp
bool UTestWidget::Initialize()
{
Super::Initialize();
EditableTextName->OnTextCommitted.AddDynamic(this, &UTestWidget::Committed);
return true;
}
void UTestWidget::Committed(const FText& Text, ETextCommit::Type CommitMethod)
{
FText NewText = Text;
GEngine->AddOnScreenDebugMessage(-1, 10, FColor::Purple, NewText.ToString());
}
And it prints to screen everything I’ve entered into the Editable Text field.
Certainly, don’t forget to #include “Components/EditableText.h” in the .cpp file and forward declare class UEditableText; in the header.