Thread: tooltip example
View Single Post
05/27/14, 09:30 AM   #3
Garkin
 
Garkin's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2014
Posts: 832
Originally Posted by hulksmash View Post
Can anyone provide a clean tooltip example? I want to create a tooltip when you mouse over button texture. I want it to look very similar if not exactly like the tooltips when you navigate the tabs in your inventory and bank. I just want a clean simple box with text inside it. I started making one from scratch but then saw some tooltip controls in the wiki that I couldn't make sense of. I dont want to use any .xml files.
Lua Code:
  1. local function ShowTooltip(self)
  2.    --InitializeTooltip(tooltipControl, [owner, point, offsetX, offsetY, relativePoint])
  3.    InitializeTooltip(InformationTooltip, self, TOPRIGHT, 0, 5, BOTTOMRIGHT)
  4.    --SetTooltipText(tooltipControl, text, [r, g, b])
  5.    SetTooltipText(InformationTooltip, "Some text")
  6.    --or you can use:
  7.    --tooltipControl:AddLine(text, [font, r, g, b, lineAnchor, modifyTextType, textAlignment, setToFullSize]), default font = ""
  8.    --tooltipControl:AddVerticalPadding(offsetY)
  9. end
  10.  
  11. local function HideTooltip(self)
  12.    --ClearTooltip(tooltipControl)
  13.    ClearTooltip(InformationTooltip)
  14. end
  15.  
  16. yourControl:SetHandler("OnMouseEnter", function(self) ShowTooltip(self) end)
  17. yourControl:SetHandler("OnMouseExit", function(self) HideTooltip(self) end)

Last edited by Garkin : 05/29/14 at 12:54 PM.
  Reply With Quote