Slate event passing pointer failed?


TSharedPtr<SEditableTextBox> MasterWinX;
TSharedPtr<SEditableTextBox> MasterWinY;

void SConfigFileGenerator::Construct(const FArguments& InArgs)
        .OnTextChanged(this, &SConfigFileGenerator::isNumber, MasterWinX)

        SAssignNew(MasterWinY, SEditableTextBox)
void SConfigFileGenerator::isNumber
(const FText& InText, TSharedPtr<SEditableTextBox> TextBox)
    FString TextBoxString = InText.ToString();

    int StringLen = TextBoxString.Len();
    TextBoxString.RemoveAt(StringLen > 0? StringLen-1 : StringLen, 1, true);

Var TextBox in isNumber() always null

But it works fine if I change passing pointer to:

SAssignNew(MasterWinX, SEditableTextBox)
.OnTextChanged(this, &SConfigFileGenerator::isNumber, MasterWinY)

I don’t understand why this happened.

Is there anyway to fix this or bind slate event after initialized?

Hello! Can you try to separate Assign(…).OnTextChanged to 2 different operators? Maybe captured value is null (it depends on how compilator parse those line of code)…

The value is null if I try to pass the pointer from itself.

Hi buddy, did you get any way out with this yet?


Sorry, haven’t solved yet. I’m just doing this another way by create custom SCompoundWidget to solve this problem.

But why do you want to pass them as params when you have them as cpp variables primarily?

Because I want to bind a function to multiple editabletextbox that can change text itself.
But I don’t want to create multiple function for each editabletextbox to do same thing.

But you can pass some index value as param while having textboxes in array and just get them by index… And the problem with null is as I said - capture effect.