How can I get the text from an editable text in C++

Hi AeolusRlcky,

This is how I’ve got it set up using the hooks:

FReply FMyOptionsCustomization::OnKeyCharHandler(const FGeometry& geo,const FCharacterEvent& charEvent) {
	TCHAR ch=charEvent.GetCharacter();
	if( (ch>=L'a' && ch<=L'z') || (ch>=L'A' && ch<=L'Z') || (ch>=L'0' && ch<=L'9') ) return FReply::Unhandled();
	return FReply::Handled();
}

FText FMyOptionsCustomization::GetMyName() const { return  FText::FromString(*MyOptions->MyName); }

void FMyOptionsCustomization::SetMyName(const FText& NewText, ETextCommit::Type InTextCommit) const { 
	MyOptions->MyName=NewText.ToString(); 
	MyOptions->bItExists=myListBlahContains(MyOptions->MyName);
}


			SNew(SEditableTextBox)
			.Text(this, &FMyOptionsCustomization::GetMyName)
			.OnTextCommitted(this, &FMyOptionsCustomization::SetMyName)
			.OnKeyCharHandler(this,&FMyOptionsCustomization::OnKeyCharHandler)
			.ForegroundColor_Lambda([=]{ return (MyOptions->bItExists)?FLinearColor(0.4f,0.0f,0.0f):FLinearColor(0.0f,0.4f,0.0f); })
			.SelectAllTextWhenFocused(true)
			.SelectAllTextOnCommit(false)
			.ClearKeyboardFocusOnCommit(true)
			.RevertTextOnEscape(true)
			.MinDesiredWidth(194)

2 Likes