View Single Post
05-25-17, 08:37 AM   #10
Ketho
A Pyroguard Emberseer
 
Ketho's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2010
Posts: 1,026
It's undocumented but you can just use GameTooltip.SetRecipeResultItem, instead of getting the Item Id for in GameTooltip.SetItemByID
Lua Code:
  1. function TradeSkillDetailsMixin:OnResultMouseEnter(resultButton)
  2.     if self.selectedRecipeID then
  3.         GameTooltip:SetOwner(resultButton, "ANCHOR_RIGHT");
  4.         GameTooltip:SetRecipeResultItem(self.selectedRecipeID);
  5.         CursorUpdate(resultButton);
  6.     end
  7.    
  8.     resultButton.UpdateTooltip = resultButton.UpdateTooltip or function(owner) self:OnResultMouseEnter(owner); end;
  9. end

This can be shortened to this
Lua Code:
  1. TradeSkillFrame:HookScript("OnHide", function()
  2.     f:Hide()
  3. end)
Lua Code:
  1. TradeSkillFrame:HookScript("OnHide", f.Hide)

Haven't tested your addon, but is the OnHide hook actually needed if you can just parent your tooltip to the TradeSkillFrame?
Code:
local f = CreateFrame("GameTooltip", "ProfessionItemtooltip", TradeSkillFrame, "GameTooltipTemplate")
  Reply With Quote