Thread Tools Display Modes
05/19/15, 01:25 AM   #1
Minceraft
 
Minceraft's Avatar
AddOn Author - Click to view addons
Join Date: Jun 2014
Posts: 51
Tooltip Types...

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
  Reply With Quote
05/19/15, 02:32 AM   #2
votan
 
votan's Avatar
AddOn Author - Click to view addons
Join Date: Oct 2014
Posts: 577
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
05/19/15, 10:35 AM   #3
Minceraft
 
Minceraft's Avatar
AddOn Author - Click to view addons
Join Date: Jun 2014
Posts: 51
Yeah It is, partially! Thank you! So if the different types are called the same way, I'm assuming then that an iconFile can be used as well? I was wanting to show icon and amount on mouse-over, to save space...figured it had to be an Item tooltip for that to work..
  Reply With Quote
05/20/15, 03:59 AM   #4
votan
 
votan's Avatar
AddOn Author - Click to view addons
Join Date: Oct 2014
Posts: 577
Originally Posted by Minceraft View Post
Yeah It is, partially! Thank you! So if the different types are called the same way, I'm assuming then that an iconFile can be used as well? I was wanting to show icon and amount on mouse-over, to save space...figured it had to be an Item tooltip for that to work..
If want to set the top icon of the ItemTooltip this should work:
Lua Code:
  1. ZO_ItemIconTooltip_OnAddGameData(ItemTooltip, TOOLTIP_GAME_DATA_ITEM_ICON, texture)
  Reply With Quote

ESOUI » Developer Discussions » Lua/XML Help » Tooltip Types...


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off