I've found that the arguments passed by SetCallBack aren't what I expected from the API docs.
Handler(event, cell, arg, button)
I've found that with these 4 arguments, it is actually the second that passes what the old 1.0 'arg' passed.
Looking at YssDrop code, I can see that Yss noticed the same thing, and actually changed those arbitrary names to:
Handler(cell, name, event, ...)
...in the callbacks of YssDrop.
Should the API be poked for this?
Hmm, I have explained it badly. It's more obvious is I paste my handler:
function addon:HandlerFunc(event, cell, arg, button)
if cell == "timeframe" then
addon:CycleTimeframe()
elseif cell == "absurdSource" then
addon:CycleAbsurd()
elseif cell == "cashflow" then
addon.db.profile.hideDetails = not addon.db.profile.hideDetails
elseif cell == "summary" then
addon.db.profile.hideSummary = not addon.db.profile.hideSummary
elseif cell == "characters" then
addon.db.profile.hideCharTotals = not addon.db.profile.hideCharTotals
elseif cell == "total" then
addon.db.profile.showCombined = not addon.db.profile.showCombined
addon.db.profile.absurdDetail = false
else
if cell == nil then
cell = auditorFocus
end
auditorFocus = cell
addon.db.profile.showCombined = false
end
addon:RefreshTip()
end
As you can see, it is 'cell' that passes what 'arg' used to pass.
I have a small question related to LibQTipClick and latest rev of LibQTip that include left / right padding as well as max cell width.
my tooltip will be filled with :SetCell to use those new args I've checked the LibQTipClick code quickly here is how I understand that they work together.
There is a new argument "arg" that is after the argument "value" and before the optional parameters of LibQTip, and this argument "arg" is the one that will be given to the callback functions, is this correct?
That is correct. I should actually put the expected arguments for SetCell() in the LQTC API docs, since that one parameter makes it slightly different from the original.
Just commited a new tomQuest2 release that use LibQTipClick-1.1 also using font, cell padding and maxWidth, it seems to work well. As I need more than one argument in my mouse handler I also use AceSerializer-3.0 to avoid generating too much garbage using tables and that seems to be working :)
Good to hear! In the latest alpha (r99), I've added a minWidth parameter which comes directly after maxWidth - I needed it to keep a consistent tooltip width for ARL.
1. LibQTip-1.0 r104 spawns an error as long as any other addon are loaded, that use an older version of LibQTip. For example:
LibQTip-1.0-21 (Testy):603: attempt to index field 'scrollChild' (a nil value)
LibQTip-1.0-21 (Testy):618: in function <Interface\AddOns\Testy\libs\LibQTip-1.0.lua:616>
LibQTip-1.0-21 (Testy):736: in function <Interface\AddOns\Testy\libs\LibQTip-1.0.lua:638>
(tail call): ?:
RepairBroker-3.1.0 Beta4\RepairBroker.lua:266: in function `RenderEquippedDurability'
RepairBroker-3.1.0 Beta4\RepairBroker.lua:247: in function <Interface\AddOns\RepairBroker\RepairBroker.lua:214>
2. Once all other addons using LibQTip have been deactivated, no more errors come up - until this is reached:
local y, x = cell:GetPosition()
print("The cell is on line "..y", column "..x)
I get the following error for the print line:
Testy-TEST\Testy.lua:27: attempt to call local 'y' (a number value)
<string>:"safecall Dispatcher[4]":4: in function <[string "safecall Dispatcher[4]"]:4>
<in C code>: ?
<string>:"safecall Dispatcher[4]":13: in function `?'
CallbackHandler-1.0-3 (Ampere):91: in function `Fire'
LibQTipClick-1.1-3 (Testy):49: in function <Interface\AddOns\Testy\libs\LibQTipClick-1.1.lua:49>
And finally 3., because I'm a noob when it comes to coding:
I tried to change the tooltip via SetCell() from the function that handles the mouseclick, but I couldn't find the right way to use SetCell() to get it working. How exactly would I have to change the tooltip from there?
local y, x = cell:GetPosition()
print("The cell is on line "..y", column "..x)
Yah, that should actually be:
print("The cell is on line "..y..", column "..x)
Note the concatenate operator ".." at the end of "y". This is also not something you'd want in your finished addon - it was merely an illustration of how to use the values returned by cell:GetPosition().
I tried to change the tooltip via SetCell() from the function that handles the mouseclick, but I couldn't find the right way to use SetCell() to get it working. How exactly would I have to change the tooltip from there?
From your handler, after getting the coordinates for the cell:
tooltip:SetCell(y, x, value, etc, etc, etc)
The "tooltip" variable must be in scope at this point or else this will fail because the tooltip will be nil.
I did it exactly like in the example but the tooltip sometimes didn't hide.
It seems when I move the mouse cursor out of the tooltip to fast the tooltip's OnLeave is never called.
Once I added a custom cellleavehandler that also calls the HideTooltip function (from the example code) the problem was gone.
tooltip:SetCallback("OnLeave", LeaveHandler)
local function LeaveHandler(event, cell, arg)
QTC.OnLeave(event, cell, arg)
HideTooltip()
end
Anyone else had that problem?
Maybe you could add a short example how to display the tooltip to the new getting started page.
I'll finaly go back to custom cell provider and LibQTip instead of LibQTipClick because some user ask me to have the possibility to click through the trackers, which means I'll put an option in my custom SetupCell that will do self:EnableMouse(true) or self:EnableMouse(false)
I'm confused by this entire post. You say "finally", as if you had been wanting to for some time...yet you've only just switched to LibQTipClick-1.1 recently. As for clicking through your trackers...what, exactly, do you mean?
I'm confused by this entire post. You say "finally", as if you had been wanting to for some time...yet you've only just switched to LibQTipClick-1.1 recently. As for clicking through your trackers...what, exactly, do you mean?
Oh no I was happy to switch to LibQTipClick it allowed me to remove my custom cell provider which I felt were not really necessary anymore since you added maxWidth and cell padding in the default provider.
If the tracker is clickable all click on the tracker will be intercept by the tracker which means that you can't interact with anything behind the tracker, that's why some people asked me to have an option to remove any interactivity on the tracker so they can interact with the world behind it.
(Not sure I was very clear in my last paragraph:p)
I've found that with these 4 arguments, it is actually the second that passes what the old 1.0 'arg' passed.
Looking at YssDrop code, I can see that Yss noticed the same thing, and actually changed those arbitrary names to:
...in the callbacks of YssDrop.
Should the API be poked for this?
Hmm, I have explained it badly. It's more obvious is I paste my handler:
As you can see, it is 'cell' that passes what 'arg' used to pass.
Glad you added them :) I'll work on a new version of tomQuest2 to use LibQTipClick and new arguments of setcell :)
also concerning the cliping of the right part of the tooltip I added a few pixel to the right padding of the cell and it was perfect no more clipping
you must be looking at the release version of YssDrop which is still using the old LibQTipClick-1.0
if you check the alpha it is using the new version and the handlers are correct
YssDrop_Enter(event, cell, name, ...) <-- just as the api states make sure you are not using the old one on accident
What Yssaril said. :)
Make sure you've changed your LibStub() call to reference LibQTipClick-1.1 - that's the only thing I can think of which would cause that behavior.
my tooltip will be filled with :SetCell to use those new args I've checked the LibQTipClick code quickly here is how I understand that they work together.
There is a new argument "arg" that is after the argument "value" and before the optional parameters of LibQTip, and this argument "arg" is the one that will be given to the callback functions, is this correct?
Now that you ask, there is. Get LibQTip-1.0 r104 - I've added cell:GetPosition():
From there, you can use SetCell() from directly within your handler function.
Alternately, you can use cell:SetupCell().
Yeah, I picked the wrong thread - it was late at night. Sorry about that.
Thank you for your answer, I'll give it a try. :)
1. LibQTip-1.0 r104 spawns an error as long as any other addon are loaded, that use an older version of LibQTip. For example:
2. Once all other addons using LibQTip have been deactivated, no more errors come up - until this is reached:
I get the following error for the print line:
And finally 3., because I'm a noob when it comes to coding:
I tried to change the tooltip via SetCell() from the function that handles the mouseclick, but I couldn't find the right way to use SetCell() to get it working. How exactly would I have to change the tooltip from there?
Strange. There haven't been any reports of this behavior until now...
Yah, that should actually be:
Note the concatenate operator ".." at the end of "y". This is also not something you'd want in your finished addon - it was merely an illustration of how to use the values returned by cell:GetPosition().
From your handler, after getting the coordinates for the cell:
The "tooltip" variable must be in scope at this point or else this will fail because the tooltip will be nil.
http://www.wowace.com/projects/libqtipclick-1-0/pages/ldb-data-object-usage/
I did it exactly like in the example but the tooltip sometimes didn't hide.
It seems when I move the mouse cursor out of the tooltip to fast the tooltip's OnLeave is never called.
Once I added a custom cellleavehandler that also calls the HideTooltip function (from the example code) the problem was gone.
tooltip:SetCallback("OnLeave", LeaveHandler)
local function LeaveHandler(event, cell, arg)
QTC.OnLeave(event, cell, arg)
HideTooltip()
end
Anyone else had that problem?
Maybe you could add a short example how to display the tooltip to the new getting started page.
Oh no I was happy to switch to LibQTipClick it allowed me to remove my custom cell provider which I felt were not really necessary anymore since you added maxWidth and cell padding in the default provider.
If the tracker is clickable all click on the tracker will be intercept by the tracker which means that you can't interact with anything behind the tracker, that's why some people asked me to have an option to remove any interactivity on the tracker so they can interact with the world behind it.
(Not sure I was very clear in my last paragraph:p)
each cell with the standard cell provider have a EnableMouse(true) will they inherit the enablemouse from the tooltip?