View Single Post
05/19/15, 02:32 AM   #2
votan
 
votan's Avatar
AddOn Author - Click to view addons
Join Date: Oct 2014
Posts: 578
Originally Posted by Minceraft View Post
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:
  1. local function AddLine(tooltip, text, color, alignment)
  2.   local r, g, b = color:UnpackRGB()
  3.   tooltip:AddLine(text, "", r, g, b, CENTER, MODIFY_TEXT_TYPE_NONE, alignment, alignment ~= TEXT_ALIGN_LEFT)
  4. end
  5.  
  6. local function AddLineCenter(tooltip, text, color)
  7.   if not color then color = ZO_TOOLTIP_DEFAULT_COLOR end
  8.   AddLine(tooltip, text, color, TEXT_ALIGN_CENTER)
  9. end
  10.  
  11. local function AddLineTitle(tooltip, text, color)
  12.   if not color then color = ZO_SELECTED_TEXT end
  13.   local r, g, b = color:UnpackRGB()
  14.   tooltip:AddLine(text, "ZoFontHeader3", r, g, b, CENTER, MODIFY_TEXT_TYPE_UPPERCASE, TEXT_ALIGN_CENTER, true)
  15. end

Is it, what you looking for?
  Reply With Quote