SamELonG
(SamELonG)
October 9, 2021, 9:30am
1
Hi ~ I have created an editable text box in Widget , then user can enter file name , and i will get this name , but i don`t know how.
And i know how to bind other userwidget component :
StartRe->OnClicked.AddDynamic(this, &UCaneraSettingsWidget::OnStartRe);
I have try
LensName->OnTextCommitted.AddDynamic(this, &UCaneraSettingsWidget::GetFileName);
but it dosen`t work , also
FileName = LensName->GetText().ToString();
dosen`t work too.
Hope anyone can teach me , thanks .
Tuerer
(Tuerer)
October 11, 2021, 1:26pm
2
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.
1 Like
Karyfan
(Karyfan)
May 17, 2024, 2:33pm
3
I have an issue with .OnTextCommited . It brings to LINK error. If I use .OnTextChanged (with proper delegate signature, of course) it works.
The LINK error is:
Error : LNK2019: unresolved external symbol “__declspec(dllimport) class UEnum * __cdecl Z_Construct_UEnum_SlateCore_ETextCommit(void)” (_imp ?Z_Construct_UEnum_SlateCore_ETextCommit@@YAPEAVUEnum @@XZ ) referenced in function “void __cdecl `dynamic initializer for ‘public: static struct UECodeGen_Private::FBytePropertyParams const Z_Construct_UFunction_UFactoryParamsWidget_OnTQtyCommited_Statics::NewProp_CommitMethod’'(void)” (??__E?NewProp_CommitMethod@Z_Construct_UFunction_UFactoryParamsWidget_OnTQtyCommited_Statics@@2UFBytePropertyParams @UECodeGen_Private@@B @@YAXXZ )
Is it that I might miss something in build.cs ?
Karyfan
(Karyfan)
May 17, 2024, 3:05pm
4
Found it. Missing dependencies : “Slate”, “SlateCore”;