Originally Posted by Minceraft
Been looking around with not a lot of luck... Could someone point me in the right direction for the implementation/usage of the Item Tooltips ? Either adding to them or creating them... Been reading the UESP code, and just not sure what to make of it really...lol
|
Examples for hooking, but external triggered:
http://www.esoui.com/downloads/info951-CritPercent.html
http://www.esoui.com/downloads/info4...tandStyle.html
All the functions, hooked there, can be used to fill your custom tooltip.
e.g. ItemTooltip:SetLink(itemLink) or PopupTooltip:SetLink(itemLink)
Setting up controls to show tooltip:
http://www.esoui.com/downloads/info405-PotionMaker.html
Showing:
Code:
InitializeTooltip(<AnyTooltip>, <owner/anchor parent control>, TOPLEFT, 10, -96, TOPRIGHT)
Hiding:
Code:
ClearTooltip(<SameTooltip as above>)
Typically called in OnMouseEnter/OnMouseExit handlers:
Code:
control:SetHandler("OnMouseEnter", function(sender) InitializeTooltip(ItemTooltip, sender, TOPRIGHT, -10, -96, TOPLEFT)
-- Add your stuff
end )
control:SetHandler("OnMouseExit", function(sender) ClearTooltip(ItemTooltip) end )
Be sure mouseEnabled="true" is used in XML or control:SetMouseEnabled(true) is call in Lua.
If you hide a window via key-bind, the mouse does not always exit the control. Calling ClearTooltip at the end of interaction or scene change can prevent the tooltip is hanging around on screen.
My typically helper functions:
Lua Code:
local function AddLine(tooltip, text, color, alignment)
local r, g, b = color:UnpackRGB()
tooltip:AddLine(text, "", r, g, b, CENTER, MODIFY_TEXT_TYPE_NONE, alignment, alignment ~= TEXT_ALIGN_LEFT)
end
local function AddLineCenter(tooltip, text, color)
if not color then color = ZO_TOOLTIP_DEFAULT_COLOR end
AddLine(tooltip, text, color, TEXT_ALIGN_CENTER)
end
local function AddLineTitle(tooltip, text, color)
if not color then color = ZO_SELECTED_TEXT end
local r, g, b = color:UnpackRGB()
tooltip:AddLine(text, "ZoFontHeader3", r, g, b, CENTER, MODIFY_TEXT_TYPE_UPPERCASE, TEXT_ALIGN_CENTER, true)
end
Is it, what you looking for?