Hello everyone,
I’m trying to add a delegate to a UEditableTextBox in UE 5.1.1.
Here’s the code:
UEditableTextBox* text_currentURL = (UEditableTextBox*)(WidgetTree->FindWidget(FName(TEXT(“text_currentURL”))));
text_currentURL->OnTextCommitted.AddDynamic(this, &Uwb_webBrowserBarWidget::currentURLTextCommited);UButton* button_close = (UButton*)(WidgetTree->FindWidget(FName(TEXT(“button_close”))));
button_close->OnClicked.AddDynamic(this, &Uwb_webBrowserBarWidget::closeBrowser);
This is called in the UUserWidget::Initialize.
Both the UEditableTextBox and the UButton are correctly defined in the actual widget BP (i can check that the WidgetTree finds them), and both delegates are correctly defined, especially the one for the text box with correct arguments:
void currentURLTextCommited(const FText& foo, ETextCommit::Type CommitType)
This code compiles well, but crashes as soon as i launch the editor.
Curiously enough, the button doesn’t crash and works well.
If i comment the OnTextCommitted.AddDynamic, i can run the game, but anything related to the Editable Text Box doesn’t work:
- assigning a delegate => crash in the editor
- trying to use GetText() => crash during runtime
- trying to use SetText() => no crash but text is not set
This is something i have been doing for ages in UE4, and my first try with UE5.
Any change i should be aware of ?
In case it’s a real problem and not a blind mistake on my side, the crash is an access violation in ScriptDelegates.h
Thanks
Cedric