Thanks Thoral for your answer.
I have tried LibQTip some days ago using the sample embedding I found on wowace.
Lua Code:
local LibQTip = LibStub('LibQTip-1.0')
local ldb = LibStub:GetLibrary("LibDataBroker-1.1")
local dataobj = ldb:NewDataObject("gmTest", {
type = "data source",
icon = "Interface\\Minimap\\Tracking\\Repair",
text = "test",
})
local function anchor_OnEnter(self)
-- Acquire a tooltip with 3 columns, respectively aligned to left, center and right
local tooltip = LibQTip:Acquire("FooBarTooltip", 3, "LEFT", "CENTER", "RIGHT")
self.tooltip = tooltip
-- Add an header filling only the first two columns
tooltip:AddHeader('Anchor', 'Tooltip')
-- Add an new line, using all columns
tooltip:AddLine('Hello', 'World', '!')
-- Use smart anchoring code to anchor the tooltip to our frame
tooltip:SmartAnchorTo(self)
-- Show it, et voilą !
tooltip:Show()
end
local function anchor_OnLeave(self)
-- Release the tooltip
LibQTip:Release(self.tooltip)
self.tooltip = nil
end
function dataobj.OnClick(frame, button)
-- empty
end
function dataobj.OnEnter(frame)
anchor_OnEnter(frame)
end
function dataobj.OnLeave(frame)
anchor_OnLeave(frame)
end
I use this way of embedding because I don't realize where to put these lines:
Lua Code:
-- Somewhere in the anchor initialization
anchor:SetScript('OnEnter', anchor_OnEnter)
anchor:SetScript('OnLeave', anchor_OnLeave)
Probably I should create a custom frame and adding them ?
Something like ?
Lua Code:
local frame = CreateFrame("Frame")
frame:SetScript('OnEnter', anchor_OnEnter)
frame:SetScript('OnLeave', anchor_OnLeave)
and remove the dataobj.OnEnter and dataobj.OnLeave parts ?
The problem instead is:
If I remove the call anchor_OnLeave when I leave the databroker, I can hover the tooltip (so I can interact and press something on it ... ) but if I trim again the anchor_onEnter it dups the tooltip.
So I tried to use an isShown() to prevent this happening but I can't suceeded.
How I can avoid this ?
Thanks very much to all.