How to set text in editable text box in c++ (in Editor)?

Hello,

i am creating an editable text box inside of an dockable tab for a plugin (the “Editor Standalone Window”) in c++ like so:

+ SGridPanel::Slot(0, 0)
   .Padding(0.0f, 5.0f)
   [
         SNew(SEditableTextBox)
         .HintText(LOCTEXT("EditableTextBox", "Some Sample Text"))
   ]

once it is created i wanna dynamically set the text inside it. I guess i would nee some type of reference to it, but i dont know how to do this. Any hints what i could do?

The use of the widget tree is explained here

widget tree

it is recommended to load the user widget from your hud class so that you have access to all your widget

AHUD * hud = Cast<AHUD >(GetWorld()->GetFirstPlayerController()->GetHUD());
UWidget* MyWidget = hud->CurrentWidget->WidgetTree->FindWidget(FName("here goes the name of your widget"));
MyWidget->SetText( your text );

Thank you for this suggestion, but i dont have access to PlayerCntroller, because this Code is for usage inside of the Editor.

Okay I figured it out:

instead of using SNew you use SAssignNew. This way you can save a reference to the currently created item. So somewhere in your .h file you define:

TSharedPtr<SEditableTextBox> EditableTextBoxPtr;

then you use SAssignNew instead of SNew:

 + SGridPanel::Slot(0, 0)
    .Padding(0.0f, 5.0f)
    [
          SAssignNew(EditableTextBoxPtr, SEditableTextBox)
          .HintText(LOCTEXT("EditableTextBox", "Some Sample Text"))
    ]

and the you be able to set the text:

EditableTextBoxPtr->SetText(LOCTEXT("ExampleFText", "Some Sample Text"));