PDA

View Full Version : Formattedtext for tooltips?



celestian
June 7th, 2018, 04:38
I've been trying to find docs of setTooltipText() and to see if there is a way to make it properly display formattedtext. Is that just not possible?

If not I suppose I could write a function that I can pass formattedtext to and get back just clean text with line breaks I guess.

Trenloe
June 7th, 2018, 04:41
https://www.fantasygrounds.com/refdoc/windowcontrol.xcp#setTooltipText

It's only a string, not formatted text.

celestian
June 7th, 2018, 05:01
https://www.fantasygrounds.com/refdoc/windowcontrol.xcp#setTooltipText

It's only a string, not formatted text.

Thanks, I figured it had to be there I just have terrible luck with search finding things there.

Sounds like I'll have to strip it all out ;(

celestian
June 7th, 2018, 06:03
If anyone else needs to do strip formattedtext to text, this works for me so far.



-- strip out formattedtext from a string
function stripFormattedText(sText)
local sTextOnly = sText;
sTextOnly = sTextOnly:gsub("</p>","\n");
sTextOnly = sTextOnly:gsub("<.?[ubiphUBIPH]>","");
sTextOnly = sTextOnly:gsub("<.?table>","");
sTextOnly = sTextOnly:gsub("<.?frame>","");
sTextOnly = sTextOnly:gsub("<.?t.?>","");
sTextOnly = sTextOnly:gsub("<.?list>","");
sTextOnly = sTextOnly:gsub("<.?li>","");
return sTextOnly;
end

Bidmaron
June 8th, 2018, 05:23
Thanks, Celestian.