How would I get the text currently hovered by mouse cursor from a (rich)textblock?

I have an item description currently setup in my game’s UI which is using a Rich Text Block. Inside the item description I’m hoping to be able to use the mouse position to get the hovered word, which I can then use for a tooltip explaining definitions etc as needed. Currently I cannot find a way to get the exact text underneath the mouse cursor. I’m hoping some equivalent of GetCharIndexFromPosition for windows text box’s exists, and I’m just unable to find it. Due to the dynamic nature of rich text box styling using text decorators/wrapping etc I can’t calculate where each word is being rendered manually by just using the font info myself. The rich text box is doing lots of really cool stuff I want to maintain, I just want be able to say “after doing all that what ended up under this X/Y pos?”.

I found `FTextLayout::GetTextLocationAt` but there doesn’t seem to be a way to get the FTextLayout out of an URichTextBlock without editing the engine source (`TextLayoutCache` is private, and then that cach is what actually holds the `TextLayout` which is again private within that making it exceedingly difficulty to access).

Any tips would be appreciated - thanks!

Steps to Reproduce

Hi,

Getting the exact position of a given word is going to be tricky, but could you instead use the SHyperlink widget to support hit testing on those specific, hoverable text segments? You’ll want to define your own Hyperlink decorator that can display the necessary definition in it’s tooltip, you could look at FTutorialHyperlinkDecorator for an example of how we’ve implemented this in the past.

Best,

Cody

Thanks for the tip - I’ll look into the hyperlink options and see if I can make it work for my design.