Thread Tools Display Modes
01-10-24, 04:46 PM   #1
Carriola
A Murloc Raider
Join Date: Jan 2024
Posts: 4
Put a clickable professoin link on a frame

Hi, I'm developing a guild addon for wow wotlk. I wanted to know if it is possible to put the link of a profession on a frame and make it clickable. When I try to insert with a generic :SetText(professionLink); and I try to click on it, it doesn't work and the professional panel doesn't open. Can anyone kindly help me plz
  Reply With Quote
01-10-24, 07:14 PM   #2
Fizzlemizz
I did that?
 
Fizzlemizz's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Dec 2011
Posts: 1,879
For a Frame.

For an EditBox.

Or possibly combined with ProfessionsUtil.OpenProfessionFrameToRecipe(recipeID)
__________________
Fizzlemizz
Maintainer of Discord Unit Frames and Discord Art.
Author of FauxMazzle, FauxMazzleHUD and Move Pad Plus.

Last edited by Fizzlemizz : 01-10-24 at 08:34 PM.
  Reply With Quote
01-10-24, 09:52 PM   #3
Xrystal
nUI Maintainer
 
Xrystal's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Feb 2006
Posts: 5,934
You could also take a look at https://www.wowinterface.com/downloa...ofessions.html which was based on my initial mage portals addon. If memory serves it opens the crafting frame.

Hopefully this old example and Fizzle's more recent page links will help you in some way.
__________________


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
  Reply With Quote
01-11-24, 02:15 AM   #4
Carriola
A Murloc Raider
Join Date: Jan 2024
Posts: 4
Thank you Fizzlemizz and Xrystal for replies. I had already tried with Frame:SetHyperlinksEnabled and EditBox:SetHyperlinksEnabled but it seems doesn't work.
Code example:
Code:
function Open_Frame_With_Link_Test1(link)

    local f = CreateFrame("Frame", "PippoPlutoPaperino", UIParent);
    f:SetSize(300, 300);
    f:SetPoint("LEFT", 100, 0);

    f:SetHyperlinksEnabled(true);
    print("passed --------");
    local pippo = f:CreateFontString(nil, "OVERLAY", "GameFontNormal");
    pippo:SetPoint("TOPLEFT", LaFratellanza_note_frame, "TOPLEFT", 30, -30);
    pippo:SetText(link);

end

function Open_Frame_With_Link_Test2(link)
    local f = CreateFrame("Frame", "PippoPlutoPaperino", UIParent);
    f:SetSize(300, 300);
    f:SetPoint("LEFT", 100, 0);

    local editBox = CreateFrame("EditBox", nil, f, "InputBoxTemplate");
    editBox:SetAllPoints();
    editBox:SetCursorPosition(0);
    editBox:SetHyperlinksEnabled(true);
    print("passed --------");
    editBox:SetText(link);

end
In both function I can't see "passed --------" printed, because it seems :SetHyperlinksEnabled have an error.

Alternatively, is there an API/function that, having the profession link (of another player), opens the tradeSkill? I would like to specify that the profession link belongs to another player, not mine professions.
  Reply With Quote
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,934
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
01-11-24, 09:44 AM   #6
Fizzlemizz
I did that?
 
Fizzlemizz's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Dec 2011
Posts: 1,879
Lua Code:
  1. function Open_Frame_With_Link_Test1(id)
  2.     if not PippoPlutoPaperino then
  3.         local f = CreateFrame("Frame", "PippoPlutoPaperino", UIParent);
  4.         PippoPlutoPaperino = f
  5.         f:SetSize(100, 55);
  6.         f:SetPoint("LEFT", 100, 0);
  7.         f:SetHyperlinksEnabled(true);
  8.         f.Text = f:CreateFontString(nil, "OVERLAY", "GameFontNormal");
  9.         f.Text:SetPoint("TOP")
  10.         f.Button = CreateFrame("Button", "PippoPlutoPaperino", f, "UIPanelButtonTemplate");
  11.         f.Button:SetSize(80, 25)
  12.         f.Button:SetText("Open")
  13.         f.Button:SetPoint("BOTTOM")
  14.         f.Button:SetScript("OnClick", function(self)
  15.             ProfessionsUtil.OpenProfessionFrameToRecipe(self:GetParent().ID)
  16.         end)
  17.  
  18.         f:SetScript("OnHyperlinkEnter", function(self, link, text, region, left, bottom, width, height)
  19.             GameTooltip:SetOwner(self, "ANCHOR_CURSOR_RIGHT")
  20.             GameTooltip:SetHyperlink(link)
  21.             GameTooltip:Show()
  22.         end)
  23.         f:SetScript("OnHyperlinkLeave", function(self)
  24.             GameTooltip:Hide()
  25.         end)
  26.         f:SetScript("OnHyperlinkClick", function(self, link, text, region, left, bottom, width, height) -- if not using a seperate button
  27.             ProfessionsUtil.OpenProfessionFrameToRecipe(PippoPlutoPaperino.ID)
  28.         end)
  29.         print("passed --------");
  30.     end
  31.     local spell = Spell:CreateFromSpellID(id);
  32.     spell:ContinueOnSpellLoad(function()
  33.         local f = PippoPlutoPaperino
  34.         local info = C_TradeSkillUI.GetRecipeInfo(id)
  35.         f.Text:SetText(info.hyperlink);
  36.         f.ID = info.recipeID
  37.     end)
  38. end

Login and:
Code:
-- 376530 Wildercloth Bolt or use a recipe ID you have
/run Open_Frame_With_Link_Test1(376530)
__________________
Fizzlemizz
Maintainer of Discord Unit Frames and Discord Art.
Author of FauxMazzle, FauxMazzleHUD and Move Pad Plus.

Last edited by Fizzlemizz : 01-11-24 at 11:30 AM.
  Reply With Quote
01-11-24, 11:13 AM   #7
Fizzlemizz
I did that?
 
Fizzlemizz's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Dec 2011
Posts: 1,879
You could use the OnHyperlinkClick to open the profession frame instead of using a separate button:
Lua Code:
  1. frame:SetScript("OnHyperlinkClick", function(self) -- if not using a seperate button
  2.     ProfessionsUtil.OpenProfessionFrameToRecipe(frame.ID)  -- frame.ID being where you stored the recipe ID for clicking
  3. end)

Updated my original example to include clicking on the hyperlink also opens the profession frame (and waiting for a link if the recipe is not cached)
__________________
Fizzlemizz
Maintainer of Discord Unit Frames and Discord Art.
Author of FauxMazzle, FauxMazzleHUD and Move Pad Plus.

Last edited by Fizzlemizz : 01-11-24 at 11:34 AM.
  Reply With Quote
01-11-24, 12:51 PM   #8
Xrystal
nUI Maintainer
 
Xrystal's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Feb 2006
Posts: 5,934
So what we have so far is ...

A way to open direct to a recipe page via a recipe id

And

A way to open the professions page from a hyperlink.


What we need now is a way to find out the recipe id from a recipe link which hopefully will be figureoutable from this page : https://warcraft.wiki.gg/wiki/Hyperlinks

Ah never mind, looks like the recipe links are either item links or enchant links.

Looking at the tradeskill window itself, it only allows people to link their whole profession not a recipe, so you might only be able to open to a particular recipe page using a known recipe ID. Unfortunately the only way I could see to get both a recipelink and recipeid automagically was by reading the recipes from the tradeskill page.

The last known recipe in my example was the Enchant Vellum I could craft with my Inscription Gal.
The recipe ID for it is 52739 but none of the numbers in the Enchant Vellum recipe link contains that number. Instead it has 38682 which is the actual item id and 70:266 which I assume is the player level and specialization id who provided the link and the next numbers that appear are 1:3524 which don't provide any clues to me but could be the number of bonsuses and a bonus id - if I am reading the info on https://warcraft.wiki.gg/wiki/ItemLink correctly.

Anyway, this is my last attempt, and is the best I could do using both the info Fizzle provided and what I tracked down and hopefully gets you part way at least.


Lua Code:
  1. local addonName,db = ...
  2.  
  3. local cf = CreateFrame("Frame","TestFrame",UIParent)
  4. cf:SetSize(600,100)
  5. cf:SetPoint("CENTER",0,0)
  6. cf:SetHyperlinksEnabled(true)
  7. cf.fs = cf:CreateFontString(nil,"OVERLAY","GameFontNormal")
  8. cf.fs:SetAllPoints()
  9. cf:SetScript("OnHyperlinkClick", ChatFrame_OnHyperlinkShow)
  10.  
  11.  
  12. local cf2 = CreateFrame("Frame","TestFrame2",UIParent)
  13. cf2:SetSize(600,100)
  14. cf2:SetPoint("TOP",cf, "BOTTOM",0,0)
  15. cf2:SetHyperlinksEnabled(true)
  16. cf2.fs = cf2:CreateFontString(nil,"OVERLAY","GameFontNormal")
  17. cf2.fs:SetAllPoints()
  18. cf2:SetScript("OnHyperlinkClick", function(self)    
  19.        
  20.     -- if you have a recipeInfo.recipeID then use that to jump to its crafting page    
  21.     if db.recipeInfo and db.recipeInfo.recipeID then
  22.         ProfessionsUtil.OpenProfessionFrameToRecipe(db.recipeInfo.recipeID)
  23.     end
  24. end)
  25.  
  26. local function OnEvent(self,event,...)    
  27.     local args = { ... }
  28.     if event == "ADDON_LOADED" and args[1] == addonName then
  29.     elseif event =="TRADE_SKILL_SHOW" then
  30.         db.link = C_TradeSkillUI.GetTradeSkillListLink()
  31.        
  32.         -- Cycles through all recipes known to the player or player who provided the link ( only tested on myself )
  33.         for _, id in pairs(C_TradeSkillUI.GetAllRecipeIDs()) do
  34.             local recipeInfo = C_TradeSkillUI.GetRecipeInfo(id)
  35.             if recipeInfo.learned then  
  36.                 print(recipeInfo.recipeID, recipeInfo.name, recipeInfo.learned)
  37.                 db.recipeInfo = recipeInfo
  38.             end
  39.         end    
  40.     end
  41.  
  42.     -- set the profession link to the first text area
  43.     cf.fs:SetText(db.link)
  44.    
  45.     -- set the last recipe found's hyperlink to the second text area
  46.     -- If you have a specific recipeInfo.hyperlink ) use that instead
  47.     if db.recipeInfo and db.recipeInfo.hyperlink then
  48.         cf2.fs:SetText(db.recipeInfo.hyperlink)
  49.     end
  50. end
  51.  
  52. local f = CreateFrame("Frame")
  53. f:RegisterEvent("ADDON_LOADED")
  54. f:RegisterEvent("PLAYER_LOGIN")
  55. f:RegisterEvent("TRADE_SKILL_SHOW")
  56. 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
  Reply With Quote
01-11-24, 01:10 PM   #9
Carriola
A Murloc Raider
Join Date: Jan 2024
Posts: 4
Thank you, you were very kind to answer me. Unfortunately, however, I don't think the solutions work. From the addon channel with SendAddonMessage(MyChannelAddon_channel, msg, "WHISPER", sender) I receive the profession link of the other guildmate For example [Tailoring]. I have to put this link on a frame that collects all the links that I receive from other guildmate.

For now the only way I've found is to put a chat frame on the frame (see screen):


Code:
function LaFratellanza_Prof_ChatFrame_Init()
    local background = CreateFrame("Frame", "LaFratellanza_ChatFrame_Backgroud", LaFratellanza_main_frame);
    background:SetSize(256, 256);
    background:SetPoint("LEFT", LaFratellanza_main_frame, "TOPRIGHT", -15, -150);
    background:SetBackdrop({
        bgFile = "Interface\\AddOns\\LaFratellanza\\texture\\frames\\finestra-laterale.tga",
        tile = false,
        insets = { left = 0, right = 0, top = 0, bottom = 0 }
    });
    background:SetFrameLevel(LaFratellanza_main_frame:GetFrameLevel()-1);

    LaFratellanza_chatFrame = FCF_OpenNewWindow("LaFratellanzaProfessioni");
    LaFratellanza_chatFrameTab = _G["ChatFrame" .. LaFratellanza_chatFrame:GetID() .. "Tab"];
    LaFratellanza_chatFrameButtonFrame = _G["ChatFrame" .. LaFratellanza_chatFrame:GetID() .. "ButtonFrame"];
    LaFratellanza_chatFrameEditBox = _G["ChatFrame" .. LaFratellanza_chatFrame:GetID() .. "EditBox"];

    ChatFrame_RemoveAllMessageGroups(LaFratellanza_chatFrame);
    ChatFrame_AddMessageGroup(LaFratellanza_chatFrame, "ADDON");
    
    LaFratellanza_chatFrame:SetScript("OnEvent", function(self, event, prefix, message)
        if event == "CHAT_MSG_ADDON" and prefix == LaFratellanza_channel then
            if string.sub(message, 1, 3) == "Res" then
                self:AddMessage(string.sub(message, 5))
            end
        end
    end)
    LaFratellanza_chatFrame:RegisterEvent("CHAT_MSG_ADDON");  
	CURRENT_CHAT_FRAME_ID = LaFratellanza_chatFrame:GetID();
	FCF_ToggleLock();
	LaFratellanza_chatFrame:SetParent(_G["LaFratellanza_Main_Frame"]);
    LaFratellanza_chatFrameTab:SetParent(_G["LaFratellanza_Main_Frame"]);
    LaFratellanza_chatFrameButtonFrame:SetParent(_G["LaFratellanza_Main_Frame"]);
    LaFratellanza_chatFrameEditBox:SetParent(_G["LaFratellanza_Main_Frame"]);

	LaFratellanza_chatFrame:ClearAllPoints();
	LaFratellanza_chatFrame:SetFrameLevel(_G["LaFratellanza_Main_Frame"]:GetFrameLevel()-1);
	LaFratellanza_chatFrame:SetWidth(220);
	LaFratellanza_chatFrame:SetHeight(180);
	LaFratellanza_chatFrame:SetPoint("TOPLEFT", _G["LaFratellanza_Main_Frame"],"TOPRIGHT", 10, -70);

    LaFratellanza_chatFrameButtonFrame:SetWidth(0);
	LaFratellanza_chatFrameButtonFrame:SetHeight(0);
    LaFratellanza_chatFrameButtonFrame:ClearAllPoints();
    LaFratellanza_chatFrameButtonFrame:SetPoint("TOPRIGHT", UIParent,"TOPRIGHT", 0, 0);
    LaFratellanza_chatFrameButtonFrame:SetFrameLevel(_G["LaFratellanza_Main_Frame"]:GetFrameLevel()-1);

    LaFratellanza_chatFrameEditBox:ClearAllPoints();
    LaFratellanza_chatFrameEditBox:SetWidth(20);
    LaFratellanza_chatFrameEditBox:SetHeight(20);
    LaFratellanza_chatFrameButtonFrame:SetPoint("TOPRIGHT", UIParent,"TOPRIGHT", 0, 0);

    FCF_SetLocked( LaFratellanza_chatFrame, 1 );
    FCF_SetWindowAlpha( LaFratellanza_chatFrame, 0 );
    LaFratellanza_chatFrame:SetMovable( false );
    LaFratellanza_chatFrame:SetResizable( false );


    local header = CreateFrame("Frame", "LaFratellanza_ChatFrame_Header", LaFratellanza_main_frame);
    header:SetSize(256, 64);
    header:SetPoint("LEFT", LaFratellanza_main_frame, "TOPRIGHT", -15, -55);
    header:SetBackdrop({
        bgFile = "Interface\\AddOns\\LaFratellanza\\texture\\frames\\header-finestra-laterale.tga",
        tile = false,
        insets = { left = 0, right = 0, top = 0, bottom = 0 }
    });
    header:SetFrameLevel(LaFratellanza_chatFrameTab:GetFrameLevel()+10);

    local headerTitle = header:CreateFontString(nil, "OVERLAY", "GameFontNormal");
    headerTitle:SetPoint("TOPLEFT", header, "TOPLEFT", 30, -30);
    headerTitle:SetText("LINK PROFESSIONI");
end


screen: https://ibb.co/GxWJcMb

but unfortunately I find chat frames unpredictable. Sometimes it disappears for no reason and i can't really hide ButtonFrame, EditBox and tab of the chat.
I will try to find another way, thank you very much!

You have been very kind!

Last edited by Carriola : 01-11-24 at 01:13 PM.
  Reply With Quote
01-11-24, 01:16 PM   #10
Fizzlemizz
I did that?
 
Fizzlemizz's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Dec 2011
Posts: 1,879
You could save a table of itemID to recipeID as you set the hyperlink text(s). But it's no good for opening the professons frame if your character doen't know the profession/recipe.
__________________
Fizzlemizz
Maintainer of Discord Unit Frames and Discord Art.
Author of FauxMazzle, FauxMazzleHUD and Move Pad Plus.
  Reply With Quote
01-11-24, 01:23 PM   #11
Xrystal
nUI Maintainer
 
Xrystal's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Feb 2006
Posts: 5,934
Lightbulb

Ah, that's how you are receiving the link.

Your addon is being used by your friends and allows them to send an addon message to your addon regarding their tradeskill. Now I am assuming that if you then monitor the chat for those messages, you should be able to get the link you need to use. All you then need to do is put that link in your frame ( which I am assuming you have been doing, but are having a problem clicking on it ). The Hyperlink code we've been using should resolve that problem.

I've never used the addon message system myself so unsure of exactly what its limits are and benefits etc. But if you have that part working as expected and have a link from that source. Then things should work with the examples we've provided.

But, out of my working example the following code is what does the work

Lua Code:
  1. local cf = CreateFrame("Frame","TestFrame",UIParent)
  2. cf:SetSize(600,100)
  3. cf:SetPoint("CENTER",0,0)
  4. cf:SetHyperlinksEnabled(true)                                                    >>>> Add this to your frame
  5. cf.fs = cf:CreateFontString(nil,"OVERLAY","GameFontNormal")
  6. cf.fs:SetText(link)                                                                      >>>> This is where you put your link
  7. cf.fs:SetAllPoints()
  8. cf:SetScript("OnHyperlinkClick", ChatFrame_OnHyperlinkShow)     >>>> Add this to your frame

When you click the link it works just like the ChatFrame and opens the profession frame to the profession linked.

I've never used these myself so was quite happy to see how easy it was to work with. So I am happy to say I learned something new.
__________________


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
  Reply With Quote
01-11-24, 01:25 PM   #12
Fizzlemizz
I did that?
 
Fizzlemizz's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Dec 2011
Posts: 1,879
Originally Posted by Carriola View Post
Unfortunately, however, I don't think the solutions work.
No, it won't. You're apparently doing this for a private server and this site is only for people playing on official Blizzard servers.
__________________
Fizzlemizz
Maintainer of Discord Unit Frames and Discord Art.
Author of FauxMazzle, FauxMazzleHUD and Move Pad Plus.
  Reply With Quote
01-11-24, 01:27 PM   #13
Xrystal
nUI Maintainer
 
Xrystal's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Feb 2006
Posts: 5,934
Originally Posted by Fizzlemizz View Post
You could save a table of itemID to recipeID as you set the hyperlink text(s). But it's no good for opening the professons frame if your character doen't know the profession/recipe.
Aren't you able to click on someone else's profession link and open the trade window to their profession info ? I thought that was the whole reason why the guild professions thing works. I can look at someone's blacksmith info in the guild even though I don't know blacksmithing. I assumed receiving a link from someone does the same thing.

Although I agree with the Open to Recipe option - but I don't think this is what they are wanting unless I misunderstood what they wanted.
__________________


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
  Reply With Quote
01-11-24, 01:32 PM   #14
Fizzlemizz
I did that?
 
Fizzlemizz's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Dec 2011
Posts: 1,879
Originally Posted by Xrystal View Post
Aren't you able to click on someone else's profession link and open the trade window to their profession info ?
Being overzealous. You can't link to a particular recipe if you don't know it.
__________________
Fizzlemizz
Maintainer of Discord Unit Frames and Discord Art.
Author of FauxMazzle, FauxMazzleHUD and Move Pad Plus.
  Reply With Quote
01-11-24, 01:35 PM   #15
Xrystal
nUI Maintainer
 
Xrystal's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Feb 2006
Posts: 5,934
Originally Posted by Fizzlemizz View Post
Being overzealous. You can't link to a particular recipe if you don't know it.
Yep I agree, looking at his screen though, it looks like it's just a profession link not a recipe link.
__________________


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
  Reply With Quote
01-11-24, 01:41 PM   #16
Fizzlemizz
I did that?
 
Fizzlemizz's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Dec 2011
Posts: 1,879
I stopped looking when it became apparent it wasn't for official servers .
__________________
Fizzlemizz
Maintainer of Discord Unit Frames and Discord Art.
Author of FauxMazzle, FauxMazzleHUD and Move Pad Plus.
  Reply With Quote
01-11-24, 02:17 PM   #17
Xrystal
nUI Maintainer
 
Xrystal's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Feb 2006
Posts: 5,934
Originally Posted by Fizzlemizz View Post
I stopped looking when it became apparent it wasn't for official servers .
I couldn't see that myself. But maybe I am missing something you know.
__________________


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
  Reply With Quote
01-11-24, 02:40 PM   #18
Xrystal
nUI Maintainer
 
Xrystal's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Feb 2006
Posts: 5,934
Originally Posted by Carriola View Post
Thank you, you were very kind to answer me. Unfortunately, however, I don't think the solutions work. From the addon channel with SendAddonMessage(MyChannelAddon_channel, msg, "WHISPER", sender) I receive the profession link of the other guildmate For example [Tailoring]. I have to put this link on a frame that collects all the links that I receive from other guildmate.

For now the only way I've found is to put a chat frame on the frame (see screen):


<snipped code for brevity>

but unfortunately I find chat frames unpredictable. Sometimes it disappears for no reason and i can't really hide ButtonFrame, EditBox and tab of the chat.
I will try to find another way, thank you very much!

You have been very kind!

This works in 10.2.5 so hopefully it will work for you

How this example addon works is when you first log in / reload the ui you can open the tradeskill of your choice and it will automatically grab the skill link and send it via addonmessage to the chatframe. The addon then stops checking for the tradeskill frame being opened and closes the window. It then sees there is an addon message and grabs the link sent earlier and puts it into the fontstring set up for it.
Clicking on that link will then bring up the trade skill window ( showing the name of the link sender - in my case me ).

Looking at the tradeskill frame there is no option for WHISPERing the tradeskill link automatically as an addon message with a special prefix. So I had to use this roundabout route to get the tradeskill link and send it manually via addonmessage with the prefix.

It adds a clickable profession link to a font string so does what you are asking, you might just have to do some additional work, to make it work in your addon.

If my example doesn't work for you in 10.2.0 or 10.2.5 then mayhap something is not working right at your end and could explain the problems you are having. And as Fizzle says, we cannot help with addons not designed to work on official servers.

Lua Code:
  1. local addonName,db = ...
  2.  
  3. -- Simple Frame to display the link(s) and control how that link works when you click it
  4. local cf = CreateFrame("Frame","TestFrame",UIParent)
  5. cf:SetSize(600,100)
  6. cf:SetPoint("CENTER",0,0)
  7. cf:SetHyperlinksEnabled(true)
  8. cf:SetScript("OnHyperlinkClick", ChatFrame_OnHyperlinkShow)
  9.  
  10. -- Font string that holds the text
  11. -- I am just using one, but you could have a list of strings set up
  12. cf.fs = cf:CreateFontString(nil,"OVERLAY","GameFontNormal")
  13. cf.fs:SetAllPoints()
  14.  
  15. local function OnEvent(self,event,...)    
  16.     local args = { ... }
  17.    
  18.     -- Register addon message prefix when the addon is loaded
  19.     if event == "ADDON_LOADED" and args[1] == addonName then
  20.         local successfulRequest = C_ChatInfo.RegisterAddonMessagePrefix("XTA-AMP")
  21.         if successfulRequest then db.addonMessagePrefix = "XTA-AMP" end
  22.        
  23.     -- This is used to get the trade skill link when they open the tradeskill frame
  24.     -- If you have another way to send the addon message the link then use that
  25.     elseif event =="TRADE_SKILL_SHOW" then
  26.         self:RegisterEvent("TRADE_SKILL_LIST_UPDATE")
  27.        
  28.     elseif event == "TRADE_SKILL_LIST_UPDATE" then
  29.         local link = C_TradeSkillUI.GetTradeSkillListLink()
  30.         local success = C_ChatInfo.SendAddonMessage(db.addonMessagePrefix, link,  "WHISPER", UnitName("player"))
  31.        
  32.         -- Make sure we close the tradeskill frame and unregister events so that it doesn't trigger until the next reload
  33.         C_TradeSkillUI.CloseTradeSkill()
  34.         self:UnregisterEvent("TRADE_SKILL_LIST_UPDATE")
  35.         self:UnregisterEvent("TRADE_SKILL_SHOW")
  36.        
  37.     -- Monitor Addon messages in the chat frame
  38.     elseif event == "CHAT_MSG_ADDON" then
  39.         -- args 1 is the prefix
  40.         -- args 2 is the message
  41.         if args[1] == db.addonMessagePrefix then
  42.             -- set the profession link to the fontstring requiring it
  43.             -- remember I am using a single fontstring, if you are using multiple, make sure you are updating the correct one
  44.             cf.fs:SetText(args[2] or "")
  45.         end
  46.            
  47.     end
  48.    
  49. end
  50.  
  51. local f = CreateFrame("Frame")
  52. f:RegisterEvent("ADDON_LOADED")
  53. f:RegisterEvent("PLAYER_LOGIN")
  54. f:RegisterEvent("TRADE_SKILL_SHOW")
  55. f:RegisterEvent("CHAT_MSG_ADDON")
  56. 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
  Reply With Quote
01-11-24, 03:24 PM   #19
Carriola
A Murloc Raider
Join Date: Jan 2024
Posts: 4
Originally Posted by Xrystal View Post
This works in 10.2.5 so hopefully it will work for you

How this example addon works is when you first log in / reload the ui you can open the tradeskill of your choice and it will automatically grab the skill link and send it via addonmessage to the chatframe. The addon then stops checking for the tradeskill frame being opened and closes the window. It then sees there is an addon message and grabs the link sent earlier and puts it into the fontstring set up for it.
Clicking on that link will then bring up the trade skill window ( showing the name of the link sender - in my case me ).

Looking at the tradeskill frame there is no option for WHISPERing the tradeskill link automatically as an addon message with a special prefix. So I had to use this roundabout route to get the tradeskill link and send it manually via addonmessage with the prefix.

It adds a clickable profession link to a font string so does what you are asking, you might just have to do some additional work, to make it work in your addon.

If my example doesn't work for you in 10.2.0 or 10.2.5 then mayhap something is not working right at your end and could explain the problems you are having. And as Fizzle says, we cannot help with addons not designed to work on official servers.

Lua Code:
  1. local addonName,db = ...
  2.  
  3. -- Simple Frame to display the link(s) and control how that link works when you click it
  4. local cf = CreateFrame("Frame","TestFrame",UIParent)
  5. cf:SetSize(600,100)
  6. cf:SetPoint("CENTER",0,0)
  7. cf:SetHyperlinksEnabled(true)
  8. cf:SetScript("OnHyperlinkClick", ChatFrame_OnHyperlinkShow)
  9.  
  10. -- Font string that holds the text
  11. -- I am just using one, but you could have a list of strings set up
  12. cf.fs = cf:CreateFontString(nil,"OVERLAY","GameFontNormal")
  13. cf.fs:SetAllPoints()
  14.  
  15. local function OnEvent(self,event,...)    
  16.     local args = { ... }
  17.    
  18.     -- Register addon message prefix when the addon is loaded
  19.     if event == "ADDON_LOADED" and args[1] == addonName then
  20.         local successfulRequest = C_ChatInfo.RegisterAddonMessagePrefix("XTA-AMP")
  21.         if successfulRequest then db.addonMessagePrefix = "XTA-AMP" end
  22.        
  23.     -- This is used to get the trade skill link when they open the tradeskill frame
  24.     -- If you have another way to send the addon message the link then use that
  25.     elseif event =="TRADE_SKILL_SHOW" then
  26.         self:RegisterEvent("TRADE_SKILL_LIST_UPDATE")
  27.        
  28.     elseif event == "TRADE_SKILL_LIST_UPDATE" then
  29.         local link = C_TradeSkillUI.GetTradeSkillListLink()
  30.         local success = C_ChatInfo.SendAddonMessage(db.addonMessagePrefix, link,  "WHISPER", UnitName("player"))
  31.        
  32.         -- Make sure we close the tradeskill frame and unregister events so that it doesn't trigger until the next reload
  33.         C_TradeSkillUI.CloseTradeSkill()
  34.         self:UnregisterEvent("TRADE_SKILL_LIST_UPDATE")
  35.         self:UnregisterEvent("TRADE_SKILL_SHOW")
  36.        
  37.     -- Monitor Addon messages in the chat frame
  38.     elseif event == "CHAT_MSG_ADDON" then
  39.         -- args 1 is the prefix
  40.         -- args 2 is the message
  41.         if args[1] == db.addonMessagePrefix then
  42.             -- set the profession link to the fontstring requiring it
  43.             -- remember I am using a single fontstring, if you are using multiple, make sure you are updating the correct one
  44.             cf.fs:SetText(args[2] or "")
  45.         end
  46.            
  47.     end
  48.    
  49. end
  50.  
  51. local f = CreateFrame("Frame")
  52. f:RegisterEvent("ADDON_LOADED")
  53. f:RegisterEvent("PLAYER_LOGIN")
  54. f:RegisterEvent("TRADE_SKILL_SHOW")
  55. f:RegisterEvent("CHAT_MSG_ADDON")
  56. f:SetScript("OnEvent",OnEvent)

Wow thanks Xrystal!! this solution works but I don't know why (I'm a beginner addon developer :P)! You are very kind! Thanks a lot Fizzlemizz too for time and advice!
Good community
  Reply With Quote

WoWInterface » Developer Discussions » Lua/XML Help » Put a clickable professoin link on a frame


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off