Hello
I have the following problem
I would like to change text in text box in my BP widget using C++ code. I have created BP class derived from my C++ class.
That is the part of my code in *.h file in my class:
UFUNCTION(BlueprintCallable, Category = "ATest")
void OnTestPressed();
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "BP Classes")
TSubclassOf<UTextBlock> testTextBlockBPClass;
The part of my code in *.cpp file in my class:
void UMyWidget::OnTestPressed()
{
if (testTextBlockBPClass)
{
UTextBlock* txtBlock = (UTextBlock*)testTextBlockBPClass->GetClass();
txtBlock->SetText(FText::FromString("Can you see your text?"));
}
}
Clicking by button I am trying to change text in my text box that is at widget.
This is how I am using blueprint script to setup my variables:
Why I did not see the text after clicking by button?
Someone please help me.