got the same problem as Mera for tooltip not appearing correctly the first time it's displayed.
and also got the same problem as jokeyrhyme with tooltip not correctly hidden sometimes (but for me it's with a custom Cell provider enabling mouse interactivity on the tooltip not with LibQTip-Click)
The tooltip appearance on initial show is a problem that Adirelle and I have looked at on and off. Maybe we need to finally nail this one.
As for the issue with the tooltip not hiding all the time, Jokeyrhyme was correct in his assumption that this is because the mouse enters the cell frame and the timing when leaving it is critical. If you move the mouse slowly, the issue doesn't exist because it registers as having entered the actual tooltip frame again. I'll be looking at how to solve that with LibQTipClick.
I ended up putting my use of LibQTipClick on hold for the time being. I basically wanted a tooltip for parts of the tooltip. These issues actually made me rethink my goals and I think for my purposes this was a little convoluted. While the library obviously has many varied uses, I don't think my application of it here was necessary or wise.
Damn you, Tor, for seducing me with your libraries!
Awesome Lib. I used it to fix column alignment and cell coloring in Broker Currency. I only spent a couple of hours on it so far so I may have noobed some of the following issues:
1) In the docs for QTip the font code did not work for me. Some kind of initialization dependency I think. I had to do the following instead:
Idle thoughts:
2) I have a lot of columns. Some way to apply a bg color to a column would be nice. That way they can alternate for better readability.
3) The first column can be a label column same as the header row. Being able to set default fonts etc for a column as well would make this easier. Currently I go back with SetCell and apply the differing fonts. This would have to not muck up the header row of course.
Thats it. Easy to use lib and these are not critical issues.
okay I am trying to dry code something up for an RP mod i am working on
it inculdes character sheets, Now I am trying to set up a system so they can change chracter sheets (right now the assumed limit is they can have up to five at a time), Assuming LibQtip/LibQTC can do this.
Now confusions on my end is i store these sheets in a non-acdb(IE standerd savedvar DB) way, so i am gonna have to parse through the sheets and get them into the tooltip. So when they click that sheet, it will set the approitate varible and make the proper update function call.
Now as i am writeing this, the other family units of my house have declared we are going out to eat, so here is my drycode(whitch is basiclly me copiing off the getting started pages)..what am i not doing and what do i need to do?
Enlighten me oh Gurus of code.
local icon = LibStub("LibDBIcon-1.0");
local QTC = LibStub('LibQTipClick-1.0');
local ldb = LibStub:GetLibrary("LibDataBroker-1.1");
ldb:NewDataObject("RollCrafter", {
type = "launcher",
icon = "Interface\\Icons\\Spell_Nature_StormReach",
OnClick = function(clickedframe, button)
InterfaceOptionsFrame_OpenToFrame(RollCraft_BlizzOptions)
if button == "RightButton" then
local Welmenu = GHM_NewFrame(RC_WelMenu)
Welmenu.ClearAll()
Welmenu:Show();
end,
})
combatFeed = ldb:NewDataObject("RollCrafter", {
type = "data feed",
icon = "Interface\\Icons\\Spell_Nature_StormReach",
label = "",
})
combatFeed.OnEnter = function(frame, button)
tooltip = QTC:Acquire("cfTip", 5, "LEFT", "LEFT", "LEFT", "LEFT","LEFT")
tooltip:Clear()
tooltip:SmartAnchorTo(self)
tooltip:SetScript("OnLeave", HideTooltip)
DisplayTooltip()
tooltip:SetCallback("OnMouseDown", myHandlerFunc)
local y, x = tooltip:AddLine()
y, x = tooltip:SetCell(y, 1, "", function() return "You pressed button 1!" end)
y, x = tooltip:SetCell(y, 2, "Button 2", function() return "You pressed button 2!" end)
y, x = tooltip:SetCell(y, 3, "Button 3", function() return "You pressed button 3!" end)
end,
OnLeave = (tt)
if MouseIsOver(tooltip) then return end
tooltip:SetScript("OnLeave", nil)
tooltip:Hide()
QTC:Release(tooltip)
tooltip = nil
end,
end,
)
)
That code has so many errors in it that I cannot point out anything that will fix it. I have, however, made some minor corrections to what you provided in order show you a couple of places where you went wrong. I'm sure I missed quite a bit, because I only touched the glaring issues - and the code itself looks nowhere close to complete as it is missing functions which are mentioned therein.
local icon = LibStub("LibDBIcon-1.0");
local QTC = LibStub('LibQTipClick-1.0');
local ldb = LibStub:GetLibrary("LibDataBroker-1.1");
local tooltip
local RollCrafter = ldb:NewDataObject("RollCrafter", {
type = "launcher",
icon = "Interface\\Icons\\Spell_Nature_StormReach",
OnClick = function(clickedframe, button)
InterfaceOptionsFrame_OpenToCategory(RollCraft_BlizzOptions)
if button == "RightButton" then
local Welmenu = GHM_NewFrame(RC_WelMenu)
Welmenu.ClearAll()
Welmenu:Show();
end
end,
}
)
local combatFeed = ldb:NewDataObject("RollCrafterCombatFeed", {
type = "data feed",
icon = "Interface\\Icons\\Spell_Nature_StormReach",
label = "",
}
)
function combatFeed.OnEnter()
tooltip = QTC:Acquire("cfTip", 5, "LEFT", "LEFT", "LEFT", "LEFT","LEFT")
tooltip:Clear()
tooltip:SmartAnchorTo(self)
tooltip:SetScript("OnLeave", HideTooltip)
DisplayTooltip()
tooltip:SetCallback("OnMouseDown", myHandlerFunc)
local y, x = tooltip:AddLine()
y, x = tooltip:SetCell(y, 1, "", function() return "You pressed button 1!" end)
y, x = tooltip:SetCell(y, 2, "Button 2", function() return "You pressed button 2!" end)
y, x = tooltip:SetCell(y, 3, "Button 3", function() return "You pressed button 3!" end)
end
function combatFeed.OnLeave()
if MouseIsOver(tooltip) then return end
tooltip:SetScript("OnLeave", nil)
tooltip:Hide()
QTC:Release(tooltip)
tooltip = nil
end
I suggest that you read Programming In Lua to help hone your Lua skills instead of blindly using cut-and-paste.
Is there a way to have a cell that is spanning columns automatically wrap to another line instead of just cutting off with ...?
ps: The tooltip issue where sometimes it comes up incorrectly the first time I have been able to reproduce easily. If a QTip is the first tooltip to be shown it will come out incorrectly, I have a feeling this probably has something to do with the Setting of the background color and borders before an actual Gametooltip has been initialized.
Load up WoW and reload the ui from inside wow. Make sure not to run the mouse over anything that will cause a tooltip to come up and the issue should present itself quite readily, hope this helps. ;)
I was thinking about going through the code and seeing what is done differently on a second go-round then applying that to the first pass or refactoring the logic, whichever seemed more efficient.
One thing I noted is that ResizeColspans() is called in tipPrototype:AddLine()/AddHeader()/SetCell(), yet the first line of ResizeColspans() is:
if not self:IsShown() then return end
...which would negate the usefulness of calling it in those places since most people using the library do not show the tooltip until after it is built. I haven't yet tested, but I think perhaps removing that line may solve the problem.
The only place where it would seem to be reliably executed is on the OnShow() of the tooltip itself, as set in InitializeTooltip():
self:SetScript('OnShow', ResizeColspans)
However, I believe this causes it to resize after it has been shown as it doesn't appear to work until the second time the tooltip is shown.
Actually I wanted ResizeColspans to be called only once, when the tooltip is first shown, which should be when it is completely built. Apparently, I did not do it right.
But your solution has the drawback of calling it and running it *on* every :SetCell / :AddLine / :AddHeader. Firstly, that should eats lots of CPU cycles. Secondly, I think it will screw the layout logic which expects all content to be added.
(BTW, you did not bump the library minor version.)
Another solution could be to use a dirty flag and an onupdate handler to layout the cells when the tooltip is actually visible.
Actually I wanted ResizeColspans to be called only once, when the tooltip is first shown, which should be when it is completely built. Apparently, I did not do it right.
But your solution has the drawback of calling it and running it *on* every :SetCell / :AddLine / :AddHeader. Firstly, that should eats lots of CPU cycles. Secondly, I think it will screw the layout logic which expects all content to be added.
Aye, I'd thought of that. Those calls to ResizeColspans() were already present, however, and removing the line which required the tooltip to be shown fixed the display problem.
After further testing, it seems that creating FontString when the tooltip is hidden might cause the issue. E.g. the following code still causes truncated strings to be displayed with r59 :
local tip = LibStub('LibQTip-1.0'):Acquire('Bla3', 3, 'LEFT', 'LEFT', 'RIGHT')
tip:Hide() -- ensure the tooltip is hidden (which is not always the case)
tip:AddLine('x', 'y', 'z')
local y,x = tip:AddLine()
y,x = tip:SetCell(y,x , 'Truc', 2)
y,x = tip:SetCell(y,x , 'Machin')
tip:SetPoint('RIGHT', UIParent)
tip:Show()
Now, if you replace the tip:Hide() by tip:Show() so the tooltip is shown during building code, everything goes fine.
Edit: note that on first creation, the tooltip is shown (because newly created frame are always shown). But when the tooltip frame is released then acquired again, it is hidden (because Release hides it). This is quite inconsistent.
Edit2: moreover, running the above code without clearing nor releasing the tooltip results in consistently adding truncated strings. I am definitively convinced this is the issue.
Edit3: I just tried this: I created the cells as child of UIParent (so they are shown) then I reparent them to the tooltip. And everything goes fine but I am afraid it might have issues with derived cell providers.
was hoping I copuld get a bit of help with a few issues I'm having? First issue is an error that keeps telling me I have overlapping cells:
"Broker_FactionItems-0.1.0\\BrokerFactionItems.lua:987: overlapping cells at column 2\nLibQTip-1.0-9 (LibQTip-1.0):473: in function <...rface\\AddOns\\LibQTip-1.0\\LibQTip-1.0\\LibQTip-1.0.lua:412>\n(tail call): ?:\nBroker_FactionItems-0.1.0\\BrokerFactionItems.lua:987: in function `OnEnter'\nBroker2FuBar-1.0\\pluginPrototype.lua:58: in function `OnFuBarEnter'
Second issue is more of a question, My tooltip can get quite long if the user wants to watch many Factions, is there a way to add a scroll bar? Currently the tooltip will only go tothe bottom of the screen then everything below is cut off since cannot scroll.
You're attempting to call SetCell() multiple times with different values on templine (which is the same line in every call), column 1. You should be doing something like this:
Thanks, that worked but I'll have to go back to Tablet anyway since I do not want to force users to only watch items for 1 or 2 factions and without a scrollbar it's not possible to see what extends beyond bottom of screen.
Rollback Post to RevisionRollBack
To post a comment, please login or register a new account.
and also got the same problem as jokeyrhyme with tooltip not correctly hidden sometimes (but for me it's with a custom Cell provider enabling mouse interactivity on the tooltip not with LibQTip-Click)
As for the issue with the tooltip not hiding all the time, Jokeyrhyme was correct in his assumption that this is because the mouse enters the cell frame and the timing when leaving it is critical. If you move the mouse slowly, the issue doesn't exist because it registers as having entered the actual tooltip frame again. I'll be looking at how to solve that with LibQTipClick.
Damn you, Tor, for seducing me with your libraries!
<.<
v.v
:D
1) In the docs for QTip the font code did not work for me. Some kind of initialization dependency I think. I had to do the following instead:
Idle thoughts:
2) I have a lot of columns. Some way to apply a bg color to a column would be nice. That way they can alternate for better readability.
3) The first column can be a label column same as the header row. Being able to set default fonts etc for a column as well would make this easier. Currently I go back with SetCell and apply the differing fonts. This would have to not muck up the header row of course.
Thats it. Easy to use lib and these are not critical issues.
okay I am trying to dry code something up for an RP mod i am working on
it inculdes character sheets, Now I am trying to set up a system so they can change chracter sheets (right now the assumed limit is they can have up to five at a time), Assuming LibQtip/LibQTC can do this.
Now confusions on my end is i store these sheets in a non-acdb(IE standerd savedvar DB) way, so i am gonna have to parse through the sheets and get them into the tooltip. So when they click that sheet, it will set the approitate varible and make the proper update function call.
Now as i am writeing this, the other family units of my house have declared we are going out to eat, so here is my drycode(whitch is basiclly me copiing off the getting started pages)..what am i not doing and what do i need to do?
Enlighten me oh Gurus of code.
I suggest that you read Programming In Lua to help hone your Lua skills instead of blindly using cut-and-paste.
><
Anyway thanks for enduring that.
Is there a way to have a cell that is spanning columns automatically wrap to another line instead of just cutting off with ...?
ps: The tooltip issue where sometimes it comes up incorrectly the first time I have been able to reproduce easily. If a QTip is the first tooltip to be shown it will come out incorrectly, I have a feeling this probably has something to do with the Setting of the background color and borders before an actual Gametooltip has been initialized.
Load up WoW and reload the ui from inside wow. Make sure not to run the mouse over anything that will cause a tooltip to come up and the issue should present itself quite readily, hope this helps. ;)
Thanks,
runamonk
One thing I noted is that ResizeColspans() is called in tipPrototype:AddLine()/AddHeader()/SetCell(), yet the first line of ResizeColspans() is:
...which would negate the usefulness of calling it in those places since most people using the library do not show the tooltip until after it is built. I haven't yet tested, but I think perhaps removing that line may solve the problem.
The only place where it would seem to be reliably executed is on the OnShow() of the tooltip itself, as set in InitializeTooltip():
However, I believe this causes it to resize after it has been shown as it doesn't appear to work until the second time the tooltip is shown.
But your solution has the drawback of calling it and running it *on* every :SetCell / :AddLine / :AddHeader. Firstly, that should eats lots of CPU cycles. Secondly, I think it will screw the layout logic which expects all content to be added.
(BTW, you did not bump the library minor version.)
Another solution could be to use a dirty flag and an onupdate handler to layout the cells when the tooltip is actually visible.
Aye, I'd thought of that. Those calls to ResizeColspans() were already present, however, and removing the line which required the tooltip to be shown fixed the display problem.
Gah.
Or we could hook the tooltip's Show() and do it there.
Now, if you replace the tip:Hide() by tip:Show() so the tooltip is shown during building code, everything goes fine.
Edit: note that on first creation, the tooltip is shown (because newly created frame are always shown). But when the tooltip frame is released then acquired again, it is hidden (because Release hides it). This is quite inconsistent.
Edit2: moreover, running the above code without clearing nor releasing the tooltip results in consistently adding truncated strings. I am definitively convinced this is the issue.
Edit3: I just tried this: I created the cells as child of UIParent (so they are shown) then I reparent them to the tooltip. And everything goes fine but I am afraid it might have issues with derived cell providers.
"Broker_FactionItems-0.1.0\\BrokerFactionItems.lua:987: overlapping cells at column 2\nLibQTip-1.0-9 (LibQTip-1.0):473: in function <...rface\\AddOns\\LibQTip-1.0\\LibQTip-1.0\\LibQTip-1.0.lua:412>\n(tail call): ?:\nBroker_FactionItems-0.1.0\\BrokerFactionItems.lua:987: in function `OnEnter'\nBroker2FuBar-1.0\\pluginPrototype.lua:58: in function `OnFuBarEnter'
here is the code thats causing the issue:
Second issue is more of a question, My tooltip can get quite long if the user wants to watch many Factions, is there a way to add a scroll bar? Currently the tooltip will only go tothe bottom of the screen then everything below is cut off since cannot scroll.
I do not plan to add a scrollbar; most addons do not need one, and I try to avoid feature creep.