@Ketho: Thank you for the LoadOnDemand tip and the other tip.
I think I can fire my tooltip script with
1) OnRecipeButtonClicked, as you showed above,
and
2) TRADE_SKILL_DATA_SOURCE_CHANGED, which fires when you open a profession window. Why need this? Because when you open a profession window, you see a recipe selected by default. I want that recipe's tooltip to be displayed too.
Now, I need to figure out how to get the item info in these two cases.
EDIT: I was able to get the recipe spell ID using the following:
Code:
hooksecurefunc(TradeSkillFrame.RecipeList, "OnRecipeButtonClicked", function(self, ...)
local recipeId = TradeSkillFrame.DetailsFrame.selectedRecipeID
print(recipeId)
end)
I was able to get the item ID using the following:
Code:
hooksecurefunc(TradeSkillFrame.RecipeList, "OnRecipeButtonClicked", function(self, ...)
local itemId = C_TradeSkillUI.GetRecipeItemLink(TradeSkillFrame.RecipeList.selectedRecipeID):match("item:(%d+):")
print(itemId)
end)
From the professions I checked so far, it works for tailoring, blacksmithing, mining but doesn't work for enchanting (most recipes), which displays spell instead of the item on the right section of the profession window. I can live with that.
Now that I got the item info, my next step is to display the item tooltip to the right of the profession window.
EDIT 2: Thanks for the tips. I was able to finish it just the way I wanted and also published it, in case others might need the same thing.
https://mods.curse.com/addons/wow/26...n-item-tooltip