Originally Posted by hulksmash
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:
local function ShowTooltip(self)
--InitializeTooltip(tooltipControl, [owner, point, offsetX, offsetY, relativePoint])
InitializeTooltip(InformationTooltip, self, TOPRIGHT, 0, 5, BOTTOMRIGHT)
--SetTooltipText(tooltipControl, text, [r, g, b])
SetTooltipText(InformationTooltip, "Some text")
--or you can use:
--tooltipControl:AddLine(text, [font, r, g, b, lineAnchor, modifyTextType, textAlignment, setToFullSize]), default font = ""
--tooltipControl:AddVerticalPadding(offsetY)
end
local function HideTooltip(self)
--ClearTooltip(tooltipControl)
ClearTooltip(InformationTooltip)
end
yourControl:SetHandler("OnMouseEnter", function(self) ShowTooltip(self) end)
yourControl:SetHandler("OnMouseExit", function(self) HideTooltip(self) end)