Okay, so you've given us a function:
SetCellScript(cellrow, cellcol, func[, arg])
Any reason why "arg" is bundled up in a table when it is passed? Seems a little annoying to have to unpack something that I didn't pack. :) If I could request something here, could SetCellScript be extended just slightly so we can list multiple arguments?
For example:
I have a function CellPassedOver(blah, foo).
I want to be able to say SetCellScript(cellrow, cellcol, CellPassedOver, blah, foo).
Just like that, no strange bundling or packing or anything. :)
EDIT: Okay, is anyone actually using SetCellScript at all? I can't for the life of me figure out how to successfully pass an argument to the funciton in question. It's more than just table encapsulation. There's some weird "userdata" thing going on. Torhal help me! Let my target function receive the naked argument(s)!
The arg is not a table - you're simply not using enough parameters for your function. I should have added examples to the API docs. I'll rectify that. For now, though, here's one:
local args = { one = "Foo", two = "Bar", three = "Baz" }
local function MyCellFuncMulti(cell, arg, button)
print(string.format("FIrst arg is %s.", arg.one))
print(string.format("Second arg is %s.", arg.two))
print(string.format("Third arg is %s.", arg.three))
end
local function MyCellFunc(cell, arg, button)
print(tostring(arg))
end
-- Use the args table
tip:SetCellScript(line, col, "OnMouseUp", MyCellFuncMulti, args)
-- Use a single value
tip:SetCellScript(line, col, "OnMouseUp", MyCellFunc, "This is a string")
Okay, so I've been having a content clipping issue lately and I can't figure it out. I'd really rather not have to mess with manually setting margins and things, and I thought the library was doing a good job of managing that up until now anyhow.
My tooltip code is pretty much:
[php]local function ShowTooltip(anchorframe)
if tooltip then QTip:Release(tooltip) end
tooltip = QTip:Acquire("SavedInstancesTooltip", 1, "LEFT")
local hFont = tooltip:GetHeaderFont()
local hFontPath, hFontSize
hFontPath, hFontSize, _ = hFont:GetFont()
hFont:SetFont(hFontPath, hFontSize, "OUTLINE")
tooltip:SetHeaderFont(hFont)
...
tooltip:SmartAnchorTo(anchorframe)
tooltip:Show()
end[/php]
That "..." is where I do quite alot of messy things. Like adding in empty lines and filling them up later, adding in extra columns and multi-spanning cells and all kinds of stuff. But that's all in the "...", so I thought doing Show() right at the end covered me.
It's the bottom-most line that is often clipped so that only the top-half of that line is visible, and the right most content is clipped similarly sometimes too. It's not everytime either, so it's been tricky for me to figure out what's going on. Is there anything I should avoid doing? Is it worth pre-populating a temporary table with the full contents first?
Okay, so I've been having a content clipping issue lately and I can't figure it out. I'd really rather not have to mess with manually setting margins and things, and I thought the library was doing a good job of managing that up until now anyhow.
Odd. This hasn't been an issue for some time. Are you using the latest version of the library?
That "..." is where I do quite alot of messy things. Like adding in empty lines and filling them up later, adding in extra columns and multi-spanning cells and all kinds of stuff. But that's all in the "...", so I thought doing Show() right at the end covered me.
It's the bottom-most line that is often clipped so that only the top-half of that line is visible, and the right most content is clipped similarly sometimes too. It's not everytime either, so it's been tricky for me to figure out what's going on. Is there anything I should avoid doing? Is it worth pre-populating a temporary table with the full contents first?
If you are using the latest lib version, I'd like to be able to see your code so I can try to replicate this. As far as pre-populating the data, it shouldn't affect the final tooltip at all.
Well, it's any of the v2.3.0-beta* versions of SavedInstances. And I've got "r120-release" set as the preferred repository tag for LibQTip-1.0 in my .pkgmeta. EggTimer seems to have right-edge-clipping but not bottom-clipping which is weird.
EDIT: BTW, if you see I'm doing anything completely noobish with my code then please enlighten me at once. :) If my hacked together spaghetti code doesn't make you all Lovecraftian first. :P
In fact, I don't see you using Clear() at all, which may be the issue - you're simply re-using the cells with pre-defined values from what I can see. Then again, I already said I needed sleep...
Thanks heaps, Torhal. I tried switching completely away from releasing, but I think the fact that column layouts are preserved through a Clear() call sort of interfered with my very complicated and messy column layouts. :)
I've thrown in some extra Clear() calls and I'm smarter with releasing and I'm not getting any clipping. Yay! And I'm using the SetAutoHideDelay() as you suggest, so I have no need to manually script OnLeave events. Very cool.
Everything was going just perfectly until I decided to throw column colouring into the mix. :)
At the moment I have 4 columns, with a single cell in the top row that spans all for columns. Then I have the odd item thrown into any of the cells beneath, distributed across those 4 columns. Often there is nothing at all in a column, sometimes a row has items in all 4 columns.
My problem is that I'm trying to use SetColumnColor(...) now. I want to colour the top (spanning) cell and the 4 columns beneath all the same colour. At the moment I can target each of those columns individually, but I can't colour or reduce the spacing that the library throws in between columns. This has the effect creating 4 separate stripes of colour, which is not the monolithic slab of colour I'm trying to create.
Any chance we can get a column-spanning version of SetColumnColor() that I can say "colour columns 1 to 4" and all those columns and the space in-between will be effected?
Or alternatively, how can I remove the space in-between just these columns?
@jokeyrhyme - I'd been thinking for awhile about adding a way to modify the cell padding. Guess it's time to do so. I'll keep you posted on that. As for the spanning column, just use SetLineColor() for that particular line.
@yssaril - I'm not sure about the usefulness of that. Care to give some use-cases?
its usefull if you have say a header that spans across multiple columns and subheadings under that in that case if you set the column color it paints that color across part of the header and looks really strange same if you have a footer that spans multiple columns.
also with a SetAreaColor function you would not need the line/column/cell functions at all since if your topleftX and bottomrightX is the same then you have your column function and if your topleftY and bottomrightX is the same you have your line function and if both Xes and both Yes equals then you have your cell function :)
I think if you had used topleftRow, topleftColumn, bottomrightRow, bottomrightColumn
instead of topleftX, topleftY, bottomrightX, bottomrightY
it would have been more clear ^^
Shouldn't be that hard, too. Instead of coloring the cell/column/row frames one would use an additional layer of frames that would be anchored to the columns/rows as needed.
Only problem would be that you'd have to know how many lines the tooltip has to reproduce the column function.
I think if you had used topleftRow, topleftColumn, bottomrightRow, bottomrightColumn
instead of topleftX, topleftY, bottomrightX, bottomrightY
it would have been more clear ^^
Shouldn't be that hard, too. Instead of coloring the cell/column/row frames one would use an additional layer of frames that would be anchored to the columns/rows as needed.
Only problem would be that you'd have to know how many lines the tooltip has to reproduce the column function.
let simplify it even more SetAreaColor(topRow,bottomRow,leftColumn,rightColumn)
but keeping track of where to place them is usually not bad at all
i know i have 2rows on top and 2 rows on bottom and my info is in column 5
with the above api this would simply become
tooltip:SetAreaColor(3,tooltip:GetLineCount()-3,5,5) -- its -3 not 2 because if colors inclusively
I'd say the Row and Column functions will probably stay unaltered because they'll help minimise frame usage. Even if we are recycling them automatically with LibQT, it's still probably a good idea to create as few as possible.
I'd say the Row and Column functions will probably stay unaltered because they'll help minimise frame usage. Even if we are recycling them automatically with LibQT, it's still probably a good idea to create as few as possible.
yea also it would break compatibility which at this point would be bad :P
Wondering if I could get some assistance. I'm moving a Tablet version of my tooltip to QTip and and am running into an issue I seem to can't get around.
Under an AddLine in Tablet, I could call a function and use GetMouseFocus():GetName() to cause another tooltip to fly out from that location and worked fine for grabbing the info to attach a tooltip to.
Do SetLineColor, SetColumnColor, and SetCellColor set the background color of their respective areas, or the text color?
to change the color the text you can either specify a new font object via SetCell or using the |caarrggbb|r code
SetCellScript(cellrow, cellcol, func[, arg])
Any reason why "arg" is bundled up in a table when it is passed? Seems a little annoying to have to unpack something that I didn't pack. :) If I could request something here, could SetCellScript be extended just slightly so we can list multiple arguments?
For example:
I have a function CellPassedOver(blah, foo).
I want to be able to say SetCellScript(cellrow, cellcol, CellPassedOver, blah, foo).
Just like that, no strange bundling or packing or anything. :)
EDIT: Okay, is anyone actually using SetCellScript at all? I can't for the life of me figure out how to successfully pass an argument to the funciton in question. It's more than just table encapsulation. There's some weird "userdata" thing going on. Torhal help me! Let my target function receive the naked argument(s)!
My tooltip code is pretty much:
[php]local function ShowTooltip(anchorframe)
if tooltip then QTip:Release(tooltip) end
tooltip = QTip:Acquire("SavedInstancesTooltip", 1, "LEFT")
local hFont = tooltip:GetHeaderFont()
local hFontPath, hFontSize
hFontPath, hFontSize, _ = hFont:GetFont()
hFont:SetFont(hFontPath, hFontSize, "OUTLINE")
tooltip:SetHeaderFont(hFont)
...
tooltip:SmartAnchorTo(anchorframe)
tooltip:Show()
end[/php]
That "..." is where I do quite alot of messy things. Like adding in empty lines and filling them up later, adding in extra columns and multi-spanning cells and all kinds of stuff. But that's all in the "...", so I thought doing Show() right at the end covered me.
It's the bottom-most line that is often clipped so that only the top-half of that line is visible, and the right most content is clipped similarly sometimes too. It's not everytime either, so it's been tricky for me to figure out what's going on. Is there anything I should avoid doing? Is it worth pre-populating a temporary table with the full contents first?
Odd. This hasn't been an issue for some time. Are you using the latest version of the library?
If you are using the latest lib version, I'd like to be able to see your code so I can try to replicate this. As far as pre-populating the data, it shouldn't affect the final tooltip at all.
EDIT: BTW, if you see I'm doing anything completely noobish with my code then please enlighten me at once. :) If my hacked together spaghetti code doesn't make you all Lovecraftian first. :P
I'll look more thoroughly later - must sleep.
EDIT: Also, you don't need to release the tooltip and re-acquire it if it already exists: Just use tooltip:Clear()
I've thrown in some extra Clear() calls and I'm smarter with releasing and I'm not getting any clipping. Yay! And I'm using the SetAutoHideDelay() as you suggest, so I have no need to manually script OnLeave events. Very cool.
At the moment I have 4 columns, with a single cell in the top row that spans all for columns. Then I have the odd item thrown into any of the cells beneath, distributed across those 4 columns. Often there is nothing at all in a column, sometimes a row has items in all 4 columns.
My problem is that I'm trying to use SetColumnColor(...) now. I want to colour the top (spanning) cell and the 4 columns beneath all the same colour. At the moment I can target each of those columns individually, but I can't colour or reduce the spacing that the library throws in between columns. This has the effect creating 4 separate stripes of colour, which is not the monolithic slab of colour I'm trying to create.
Any chance we can get a column-spanning version of SetColumnColor() that I can say "colour columns 1 to 4" and all those columns and the space in-between will be effected?
Or alternatively, how can I remove the space in-between just these columns?
@yssaril - I'm not sure about the usefulness of that. Care to give some use-cases?
also with a SetAreaColor function you would not need the line/column/cell functions at all since if your topleftX and bottomrightX is the same then you have your column function and if your topleftY and bottomrightX is the same you have your line function and if both Xes and both Yes equals then you have your cell function :)
example pic http://www.wowace.com/addons/ysscompare/images/3-ldb-hover-tooltip/ using the column function simply doesn't look right due to the top and bottom parts
topleftRow, topleftColumn, bottomrightRow, bottomrightColumn
instead of
topleftX, topleftY, bottomrightX, bottomrightY
it would have been more clear ^^
Shouldn't be that hard, too. Instead of coloring the cell/column/row frames one would use an additional layer of frames that would be anchored to the columns/rows as needed.
Only problem would be that you'd have to know how many lines the tooltip has to reproduce the column function.
let simplify it even more SetAreaColor(topRow,bottomRow,leftColumn,rightColumn)
but keeping track of where to place them is usually not bad at all
i know i have 2rows on top and 2 rows on bottom and my info is in column 5
with the above api this would simply become
tooltip:SetAreaColor(3,tooltip:GetLineCount()-3,5,5) -- its -3 not 2 because if colors inclusively
yea also it would break compatibility which at this point would be bad :P
Under an AddLine in Tablet, I could call a function and use GetMouseFocus():GetName() to cause another tooltip to fly out from that location and worked fine for grabbing the info to attach a tooltip to.
I've tried many variants in QTip to get the same result, but everything so far has returned 'nil'.
Any help, if this is possible, would be appreciated.