ESOUI

ESOUI (https://www.esoui.com/forums/index.php)
-   Lua/XML Help (https://www.esoui.com/forums/forumdisplay.php?f=175)
-   -   Tooltip Types... (https://www.esoui.com/forums/showthread.php?t=4737)

Minceraft 05/19/15 01:25 AM

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 ;)

votan 05/19/15 02:32 AM

Quote:

Originally Posted by Minceraft (Post 21282)
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 :rolleyes:

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?

Minceraft 05/19/15 10:35 AM

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..

votan 05/20/15 03:59 AM

Quote:

Originally Posted by Minceraft (Post 21287)
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)


All times are GMT -6. The time now is 11:44 AM.

vBulletin © 2024, Jelsoft Enterprises Ltd
© 2014 - 2022 MMOUI