cpp:
TSharedPtr<SEditableTextBox> MasterWinX;
TSharedPtr<SEditableTextBox> MasterWinY;
void SConfigFileGenerator::Construct(const FArguments& InArgs)
{
ChildSlot
[
//...
.OnTextChanged(this, &SConfigFileGenerator::isNumber, MasterWinX)
//...
SAssignNew(MasterWinY, SEditableTextBox)
]
}
void SConfigFileGenerator::isNumber
(const FText& InText, TSharedPtr<SEditableTextBox> TextBox)
{
FString TextBoxString = InText.ToString();
if(TextBoxString.IsNumeric())
{
return;
}
int StringLen = TextBoxString.Len();
TextBoxString.RemoveAt(StringLen > 0? StringLen-1 : StringLen, 1, true);
TextBox.Get()->SetText(FText::FromString(TextBoxString));
}
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?