Widget handler: OnTooltipSetItem

From AddOn Studio
Revision as of 04:55, 31 December 2007 by WoWWiki>Siz (New page: {{widgetmethod}} Invoked when an item's information is added to a tooltip. == Arguments == :;arg1: Tooltip - The Tooltip object to which an item was added. == Example == -- overload ...)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Widget API ← OnTooltipSetItem < OnTooltipSetItem

Invoked when an item's information is added to a tooltip.

Arguments

arg1
Tooltip - The Tooltip object to which an item was added.

Example

-- overload the base function for ItemRefTooltip with a custom routine
Saved_OnTooltipSetItem = ItemRefTooltip:GetScript("OnTooltipSetItem");
ItemRefTooltip:SetScript("OnTooltipSetItem", My_OnTooltipSetItem);
-- my custom routine
function My_OnTooltipSetItem (tooltip, ...)
  Saved_OnTooltipSetItem(tooltip, ...);
  local name, link = tooltip:GetItem()
  local texture = select(10, GetItemInfo(link))
  --Add the name and path of the item's texture
  tooltip:AddLine(texture)
  --Show the texture graphic on the previous line
  tooltip:AddTexture(texture)
  --Repaint tooltip with newly added lines
  tooltip:Show()
end


Details

This function was added in WoW 2.0.3
This gets called twice for Recipes which contain embedded items