LDB DataObject Usage

When using LibQTipClick with a LibDataBroker DataObject, you must ensure that the tooltip stays on-screen when the mouse is hovering over it. One way to do this is to use DO.OnEnter() and DO.OnLeave() with a local HideTooltip() function, as so:
local function HideTooltip()
	if MouseIsOver(tooltip) then return end
	tooltip:SetScript("OnLeave", nil)
	tooltip:Hide()
	QTC:Release(tooltip)
	tooltip = nil
end
function DO.OnEnter(self)
	tooltip = QTC:Acquire("MyAddonTooltip", 4, "LEFT", "LEFT", "CENTER", "CENTER")
	tooltip:Clear()
	tooltip:SmartAnchorTo(self)
	tooltip:SetScript("OnLeave", HideTooltip)
	DisplayTooltip()
end
function DO.OnLeave(self)
	HideTooltip()
end

Comments

Posts Quoted:
Reply
Clear All Quotes