PDA

View Full Version : formattedtextcontrol getIndexAt() ?



GEONE
October 9th, 2023, 10:50
Hello! I'd like to be able to get the text under the cursor using the getIndexAt function that the 5E ruleset uses for highlighting NPC action clauses when hovered over.

The problem is that I am using a formatted text control, as its necessary to get the formatting I need, but it seems that since the formattedtextcontrol doesn't inherit from textbasecontrol, it doesn't have the getIndexAt function. Is there any way to replicate or recreate the functionality of getting the character index at a given x, y position in a formattedtextcontrol?



function onHoverUpdate(x, y)
local nMouseIndex = getIndexAt(x, y); // works with any textbasecontrol but not with a formattedtextcontrol
end

Trenloe
October 9th, 2023, 11:15
I don't know of a way to do this currently in a formatted text control, the published API doesn't support it.

GEONE
October 9th, 2023, 11:37
That's unfortunate. Thank you for the reply