to be able to click on my tooltip I've done the following to the OnLeave component of my datablock:
function dataobj.OnLeave(self)
if MouseIsOver(tip) then return end
tooltipIsShown = false
tip:Hide()
end
the problem is that when I leave the tooltip it stay open, do I have a way to show the tooltip when I mouseover the tooltip, but hide it when I leave it?
Firstly, you should at least do LibQTip:Release(tip) instead of simply :Hide(). I am a bit surprised the display addon hides the tooltip as soon as the mouse leave the block. Nevertheless, I think this could work, though it is a bit hacky:
local function HideTooltip()
tip:SetScript('OnLeave', nil)
tooltipIsShown = false
LibQTip:Release(tip)
end
function dataobj.OnLeave(self)
if MouseIsOver(tip) then
tip:SetScript('OnLeave', HideTooltip)
else
HideTooltip()
end
end
Firstly, you should at least do LibQTip:Release(tip) instead of simply :Hide(). I am a bit surprised the display addon hides the tooltip as soon as the mouse leave the block. Nevertheless, I think this could work, though it is a bit hacky:
local function HideTooltip()
tip:SetScript('OnLeave', nil)
tooltipIsShown = false
LibQTip:Release(tip)
end
function dataobj.OnLeave(self)
if MouseIsOver(tip) then
tip:SetScript('OnLeave', HideTooltip)
else
HideTooltip()
end
end
It's working but I had to add
if MouseIsOver(tip) then return end to the HideTooltip function
so here is a summary to get everything working :
I had to add self:EnableMouse(true) to the SetupCell to get the clickable cell working. I also had to add tip:EnableMouse(true) to get it respond to the OnLeave script.
If I only set the EnableMouse(true) to the tip the clickable cell did not work, and if I set it to both then when I go over the clickable cell then the tooltip was hidden so I had to put the if MouseIsOver(tip) then return end to get everything working.
I got some strange behavior sometimes using colspan and justification
As you can see in the attached screenshot the text is going out of the tooltip, and tooltip1 screenshot is displayed the first time my tooltip is shown, tooltip2 screenshot is displayed every other time
the code used is quite simple :
function dataobj.OnEnter(self)
tip = LibQTip:Acquire("tomQuestToolTip", 3, "LEFT","RIGHT", "RIGHT")
local templine
tip:EnableMouse(true)
local titleLine = tip:AddLine("")
tip:SetCell(titleLine, 1, "tomQuest", nil, "CENTER", 3)
tip:AddLine(" ")
local zoneHeader = tip:AddHeader("")
local zone = string.format("%s |cff%02x%02x%02x%s (%s-%s)|r", plus, 0*255, 0.9*255, 0.1*255, "Ceci est un test de zone", 70, 80)
tip:SetCell(zoneHeader, 1, zone,nil, "LEFT", 3)
templine = tip:AddLine("")
tip:SetCell(templine, 1, "|cffeda55fClick Gauche|r", nil, "LEFT", 1)
tip:SetCell(templine, 2, "|cff19ff19Ouvrir le journal de quête.|r",nil,"RIGHT",2)
templine = tip:AddLine("")
tip:SetCell(templine, 1, "|cffeda55fCtrl + Click Gauche|r", nil, "LEFT", 1)
tip:SetCell(templine, 2, "|cff19ff19Partager la quête.|r", nil, "RIGHT", 2)
templine = tip:AddLine("")
tip:SetCell(templine, 1, "|cffeda55fShift + Click Gauche|r", nil, "LEFT", 1)
tip:SetCell(templine, 2, "|cff19ff19Mettre la quête au tracker.|r", nil, "RIGHT", 2)
templine = tip:AddLine("")
tip:SetCell(templine, 1, "|cffeda55fClick Droit|r", nil, "LEFT", 1)
tip:SetCell(templine, 2, "|cff19ff19Afficher le tooltip de quête.|r", nil, "RIGHT", 2)
templine = tip:AddLine("")
tip:SetCell(templine, 1, "|cffeda55fShift + Click Droit|r", nil, "LEFT", 1)
tip:SetCell(templine, 2, "|cff19ff19Linker la quête.|r", nil, "RIGHT", 2)
templine = tip:AddLine("")
tip:SetCell(templine, 1, "|cffeda55fCtrl + Click Droit|r", nil, "LEFT", 1)
tip:SetCell(templine, 2, "|cff19ff19Envoyer le statut de la quête.|r", nil, "RIGHT", 2)
tip:Show()
tip:SmartAnchorTo(self)
end
& BTW, i think it's saft to say that if the tip is going to be used often you should keep the tip between uses. so that first line turns into
local tip
function dataobj.OnEnter(self)
tip = tip or LibQTip:Acquire("tomQuestToolTip", 3, "LEFT","RIGHT", "RIGHT")
Actually LDB display addons often display only one tooltip at a time. So it is better to acquire the tooltip OnEnter and release it OnLeave, so different dataobjects could reuse the same Frame instances (one for the tooltip and several internal Frames). If each dataobject acquires is own tooltip without releasing it, you will end up with as many Frame instances as dataobjects, which defeats the recycling purpose of QTip.
I'm playing a bit with libQtip to do a clickable tooltip for a faction broker plugin but I still have some bugs with part of the text going out of the tooltip...
I've attached the addon and the screenshot of the tooltip to show the problem
tomFactions_tip1.jpg is ok all faction are displayed
tomFactions_tip2.jpg is still ok some factions are collapsed
tomFactions_tip3.jpg is ko I've collapsed all but one faction header and the content of this faction header is as you can see out of the tooltip.
In reference to ticket #2: Adirelle asked me this morning what I thought, and I said my initial thought was to check for "|T". This was also his conclusion. Later, I asked Kaelten what his opinion was and was told that he concurred...with the exception that he thinks we should NOT recycle these fontstrings and let the GC handle them.
I don't see why we shouldn't recycle them using a separate heap, but I'm willing to try Kaelten's method and see what kind of performance degradation (if any) we see from addons using it in the wild (Zhinjio's Extractor being the only example I can think of off-hand).
I'm playing a bit with libQtip to do a clickable tooltip for a faction broker plugin but I still have some bugs with part of the text going out of the tooltip...
This may have something to do with the issues we're seeing in fontstrings with embedded textures...but I haven't actually looked extensively at your code yet so I cannot be certain. It did throw me a bit to see that it was in French. :)
In reference to ticket #2: Adirelle asked me this morning what I thought, and I said my initial thought was to check for "|T". This was also his conclusion. Later, I asked Kaelten what his opinion was and was told that he concurred...with the exception that he thinks we should NOT recycle these fontstrings and let the GC handle them.
I don't see why we shouldn't recycle them using a separate heap, but I'm willing to try Kaelten's method and see what kind of performance degradation (if any) we see from addons using it in the wild (Zhinjio's Extractor being the only example I can think of off-hand).
Thoughts?
Actually I was not thinking about a separate heap for fontstrings but just having one or two fontstrings in the cell itself and choosing the good one in :SetupCell. Obviously, it would try to stick to one fontstring as long as possible. Moreover, IIRC, widgets are never garbage-collected, but we should ask someone who knows to be sure.
Actually I was not thinking about a separate heap for fontstrings but just having one or two fontstrings in the cell itself and choosing the good one in :SetupCell. Obviously, it would try to stick to one fontstring as long as possible. Moreover, IIRC, widgets are never garbage-collected, but we should ask someone who knows to be sure.
Ok...I need to not read the forums immediately after stumbling out of bed. Yay, me!
I've finally tagged all of the accumulated fixes/changes as v1.0.1-beta, so hammer on it and see how it holds up. Added functions for default label providers to allow easier integration with extension libraries (amongst other uses).
For Adirelle or Kaelten's attention: I have discovered the cause of the formatting issues and I am currently trying to formulate a fix though I would appreciate a fresh set of eyes or two since I've been tracking this down for hours. Check out ticket #7.
Can this be used in place of TabletLib? I'm tinkering with a new addon, and I want to have both FuBar and LDB support built-in, and would prefer to just use the one library for both. Does LibFuBarPlugin-3.0 need to be updated to know about QTip?
It depends on which features of TabletLib your addon is relying on. If you just needed a multicolumn tootlip, LibQTip should fit. If you needed clickable cells, LibQTipClick should too. If you needed more (detachable toooltip, vertical scroll bar), the answer is no.
the problem is that when I leave the tooltip it stay open, do I have a way to show the tooltip when I mouseover the tooltip, but hide it when I leave it?
It's working but I had to add
if MouseIsOver(tip) then return end to the HideTooltip function
so here is a summary to get everything working :
I had to add self:EnableMouse(true) to the SetupCell to get the clickable cell working. I also had to add tip:EnableMouse(true) to get it respond to the OnLeave script.
If I only set the EnableMouse(true) to the tip the clickable cell did not work, and if I set it to both then when I go over the clickable cell then the tooltip was hidden so I had to put the if MouseIsOver(tip) then return end to get everything working.
so in the end thank you for all your help.
As you can see in the attached screenshot the text is going out of the tooltip, and tooltip1 screenshot is displayed the first time my tooltip is shown, tooltip2 screenshot is displayed every other time
the code used is quite simple :
& BTW, i think it's saft to say that if the tip is going to be used often you should keep the tip between uses. so that first line turns into
Actually LDB display addons often display only one tooltip at a time. So it is better to acquire the tooltip OnEnter and release it OnLeave, so different dataobjects could reuse the same Frame instances (one for the tooltip and several internal Frames). If each dataobject acquires is own tooltip without releasing it, you will end up with as many Frame instances as dataobjects, which defeats the recycling purpose of QTip.
I've attached the addon and the screenshot of the tooltip to show the problem
tomFactions_tip1.jpg is ok all faction are displayed
tomFactions_tip2.jpg is still ok some factions are collapsed
tomFactions_tip3.jpg is ko I've collapsed all but one faction header and the content of this faction header is as you can see out of the tooltip.
r43 of libQTip was used for my tests
I don't see why we shouldn't recycle them using a separate heap, but I'm willing to try Kaelten's method and see what kind of performance degradation (if any) we see from addons using it in the wild (Zhinjio's Extractor being the only example I can think of off-hand).
Thoughts?
This may have something to do with the issues we're seeing in fontstrings with embedded textures...but I haven't actually looked extensively at your code yet so I cannot be certain. It did throw me a bit to see that it was in French. :)
Actually I was not thinking about a separate heap for fontstrings but just having one or two fontstrings in the cell itself and choosing the good one in :SetupCell. Obviously, it would try to stick to one fontstring as long as possible. Moreover, IIRC, widgets are never garbage-collected, but we should ask someone who knows to be sure.
Ok...I need to not read the forums immediately after stumbling out of bed. Yay, me!
It depends on which features of TabletLib your addon is relying on. If you just needed a multicolumn tootlip, LibQTip should fit. If you needed clickable cells, LibQTipClick should too. If you needed more (detachable toooltip, vertical scroll bar), the answer is no.
No.
Anyhow, I notice that my addon's tooltip (using QTip) doesn't seem to honor these settings. :(
Here's what I have when setting up my LDB object:
Is this a sequence problem? Am I setting up my tooltip properly? Is it possible for CowTip and LibQTip to work together?
I'm sort of worried because I've actually stopped using addons in the past if their tooltips didn't match, but this is my own addon. :P