View Single Post
01-11-24, 08:58 AM   #5
Xrystal
nUI Maintainer
 
Xrystal's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Feb 2006
Posts: 5,937
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:
  1. local addonName,db = ...
  2.  
  3. local cf = CreateFrame("Frame","TestFrame",UIParent)
  4. cf:SetSize(600,300)
  5. cf:SetPoint("CENTER",0,0)
  6. cf:SetHyperlinksEnabled(true)
  7. cf.fs = cf:CreateFontString(nil,"OVERLAY","GameFontNormal")
  8. cf.fs:SetAllPoints()
  9. cf.fs:SetText("Waiting")
  10.  
  11.  
  12. local function OnEvent(self,event,...)    
  13.     local args = { ... }
  14.     if event == "ADDON_LOADED" and args[1] == addonName then
  15.     elseif event =="TRADE_SKILL_SHOW" then
  16.         db.link = C_TradeSkillUI.GetTradeSkillListLink()
  17.         cf.fs:SetText(db.link)
  18.         C_TradeSkillUI.CloseTradeSkill()
  19.     end
  20. end
  21.  
  22. local f = CreateFrame("Frame")
  23. f:RegisterEvent("ADDON_LOADED")
  24. f:RegisterEvent("PLAYER_LOGIN")
  25. f:RegisterEvent("TRADE_SKILL_SHOW")
  26. 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:
  1. local addonName,db = ...
  2.  
  3. local cf = CreateFrame("Frame","TestFrame",UIParent)
  4. cf:SetSize(600,300)
  5. cf:SetPoint("CENTER",0,0)
  6. cf:SetHyperlinksEnabled(true)
  7. cf.fs = cf:CreateFontString(nil,"OVERLAY","GameFontNormal")
  8. cf.fs:SetAllPoints()
  9. cf.fs:SetText("Waiting")
  10.  
  11. cf:SetScript("OnHyperlinkClick", ChatFrame_OnHyperlinkShow)
  12.  
  13.  
  14. local function OnEvent(self,event,...)    
  15.     local args = { ... }
  16.     if event == "ADDON_LOADED" and args[1] == addonName then
  17.     elseif event =="TRADE_SKILL_SHOW" then
  18.         db.link = C_TradeSkillUI.GetTradeSkillListLink()
  19.        
  20.         for _, id in pairs(C_TradeSkillUI.GetAllRecipeIDs()) do
  21.             local recipeInfo = C_TradeSkillUI.GetRecipeInfo(id)
  22.             if recipeInfo.learned then
  23.                 print(recipeInfo.recipeID, recipeInfo.name, recipeInfo.learned)
  24.                 db.recipe = C_TradeSkillUI.GetRecipeInfo(id)
  25.             end
  26.         end
  27.     end
  28.    
  29.     local textLink = ""
  30.     if db.link then
  31.         textLink = textLink .. db.link
  32.     end
  33.     if db.recipe and db.recipe.hyperlink then
  34.         textLink = textLink .. ", " .. db.recipe.hyperlink
  35.     end
  36.     cf.fs:SetText(textLink)
  37.  
  38.    
  39. end
  40.  
  41. local f = CreateFrame("Frame")
  42. f:RegisterEvent("ADDON_LOADED")
  43. f:RegisterEvent("PLAYER_LOGIN")
  44. f:RegisterEvent("TRADE_SKILL_SHOW")
  45. f:SetScript("OnEvent",OnEvent)
__________________


Characters:
Gwynedda - 70 - Demon Warlock
Galaviel - 65 - Resto Druid
Gamaliel - 61 - Disc Priest
Gwynytha - 60 - Survival Hunter
Lienae - 60 - Resto Shaman
Plus several others below level 60

Info Panel IDs : http://www.wowinterface.com/forums/s...818#post136818

Last edited by Xrystal : 01-11-24 at 10:44 AM.
  Reply With Quote