Hi I’m trying to use a UMG widget as a tool tip for a slate text box but I’m unsure how to do this can some one show me how?
here’s my code
.h
UCLASS()
class UMG_API URichTextTooltip : public URichTextBlockDecorator {
GENERATED_BODY()
public:
virtual TSharedPtr<ITextDecorator> CreateDecorator(URichTextBlock* InOwner);
URichTextTooltip(const FObjectInitializer& ObjectInitializer);
};
.cpp
class UMG_API FRichTextTooltipS : public FRichTextDecorator {
public:
FRichTextTooltipS(URichTextBlock* InOwner, URichTextTooltip* decorator) : FRichTextDecorator(InOwner) {
};
virtual bool Supports(const FTextRunParseResults& RunParseResult, const FString& Text) const override {
if (RunParseResult.Name == TEXT("Wid") && RunParseResult.MetaData.Contains(TEXT("id"))) {
const FTextRange& IdRange = RunParseResult.MetaData[TEXT("id")];
const FString TagId = Text.Mid(IdRange.BeginIndex, IdRange.EndIndex - IdRange.BeginIndex);
}
};
protected:
virtual TSharedPtr<SWidget> CreateDecoratorWidget(const FTextRunInfo& RunInfo, const FTextBlockStyle& TextStyle) const override {
const bool bWarnIfMissing = true;
RunInfo;
TSharedPtr<STextBlock> Box = SNew(STextBlock);
//Not sure what to put in SetToolTip()
Box->SetToolTip();
return Box;
};
// = SNew(STextBlock)
};