Managed to rig up a simple addon and can confirm that the SetHyperlinksEnabled isn't working as is on a frame .. maybe something else is needed. Will investigate further.
Lua Code:
local addonName,db = ...
local cf = CreateFrame("Frame","TestFrame",UIParent)
cf:SetSize(600,300)
cf:SetPoint("CENTER",0,0)
cf:SetHyperlinksEnabled(true)
cf.fs = cf:CreateFontString(nil,"OVERLAY","GameFontNormal")
cf.fs:SetAllPoints()
cf.fs:SetText("Waiting")
local function OnEvent(self,event,...)
local args = { ... }
if event == "ADDON_LOADED" and args[1] == addonName then
elseif event =="TRADE_SKILL_SHOW" then
db.link = C_TradeSkillUI.GetTradeSkillListLink()
cf.fs:SetText(db.link)
C_TradeSkillUI.CloseTradeSkill()
end
end
local f = CreateFrame("Frame")
f:RegisterEvent("ADDON_LOADED")
f:RegisterEvent("PLAYER_LOGIN")
f:RegisterEvent("TRADE_SKILL_SHOW")
f:SetScript("OnEvent",OnEvent)
Second Attempt after some research is as follows:
The Profession Link works fine as if you had clicked in the chat frame, but I had problems getting it to accept the individual recipe link in the same manner. Fizzle's post will hopefully help in that regard.
Main addition is the Hyperlink line based on info on
https://warcraft.wiki.gg/wiki/UIHAND...HyperlinkClick
Lua Code:
local addonName,db = ...
local cf = CreateFrame("Frame","TestFrame",UIParent)
cf:SetSize(600,300)
cf:SetPoint("CENTER",0,0)
cf:SetHyperlinksEnabled(true)
cf.fs = cf:CreateFontString(nil,"OVERLAY","GameFontNormal")
cf.fs:SetAllPoints()
cf.fs:SetText("Waiting")
cf:SetScript("OnHyperlinkClick", ChatFrame_OnHyperlinkShow)
local function OnEvent(self,event,...)
local args = { ... }
if event == "ADDON_LOADED" and args[1] == addonName then
elseif event =="TRADE_SKILL_SHOW" then
db.link = C_TradeSkillUI.GetTradeSkillListLink()
for _, id in pairs(C_TradeSkillUI.GetAllRecipeIDs()) do
local recipeInfo = C_TradeSkillUI.GetRecipeInfo(id)
if recipeInfo.learned then
print(recipeInfo.recipeID, recipeInfo.name, recipeInfo.learned)
db.recipe = C_TradeSkillUI.GetRecipeInfo(id)
end
end
end
local textLink = ""
if db.link then
textLink = textLink .. db.link
end
if db.recipe and db.recipe.hyperlink then
textLink = textLink .. ", " .. db.recipe.hyperlink
end
cf.fs:SetText(textLink)
end
local f = CreateFrame("Frame")
f:RegisterEvent("ADDON_LOADED")
f:RegisterEvent("PLAYER_LOGIN")
f:RegisterEvent("TRADE_SKILL_SHOW")
f:SetScript("OnEvent",OnEvent)