View Single Post
03-19-20, 01:20 PM   #1
gmarco
An Onyxian Warder
 
gmarco's Avatar
AddOn Author - Click to view addons
Join Date: Dec 2009
Posts: 362
LibQTip tooltip hides when there is a script on line or cell

Hi all.

Being confined in home in Italy in this period (and I stayed in home also from november to january with a broken leg) I decided to rewrite some of my addons in a (better) way.

I try to use LibQTip again where possible to expand the possibilities of them (I had tried in the past too .

The first experiment I have done is a little guild and friends ldb and it works:



Now I'd like to implement the possibility to whisper and invite clicking on the row of the names but when I mouse over on the line the tooltip close.

This is a small sample code that I have used:


Lua Code:
  1. local ADDON = ...
  2.  
  3. local function Button_OnClick(rowline, name, button)
  4.     print("Never arrives here")
  5. end
  6.  
  7. local LibQTip = LibStub('LibQTip-1.0')
  8. local ldb = LibStub:GetLibrary("LibDataBroker-1.1")
  9.  
  10. local dataobj = ldb:NewDataObject(ADDON, {
  11.     type = "data source",
  12.     icon = "Interface\\Addons\\"..ADDON.."\\icon.tga",
  13.     text = "-"
  14. })
  15.  
  16. local function anchor_OnEnter(self)
  17.     local row,col
  18.     local tooltip = LibQTip:Acquire(ADDON.."tip", 4, "LEFT", "LEFT", "LEFT","LEFT")
  19.     self.tooltip = tooltip
  20.     tooltip:SmartAnchorTo(self)
  21.  
  22.     row,col = tooltip:AddHeader()
  23.     tooltip:SetCell(row,1,ADDON,"LEFT",4)
  24.    
  25.     row,col = tooltip:AddLine("var1","var2","var3","var4")
  26.     tooltip:SetLineScript(row, 'OnMouseDown', Button_OnClick, "var1")  
  27.  
  28.     tooltip:SetScript("OnLeave", function(self) self:Release() tooltip = nil end)
  29.     row,col = tooltip:Show()
  30. end
  31.  
  32. dataobj.OnEnter = function(self)
  33.     anchor_OnEnter(self)
  34. end
  35.  
  36. dataobj.OnLeave = function(self)
  37.     -- Null operation: Some LDB displays get cranky if this method is missing.
  38. end

The tooltip is shown until I dont over with the mouse on line:
"var1","var2","var3","var4"

and it works fine ...

when I pass on that line it disappears. No need to click.
The print inside is never called.

If I remove the function I can on mouse over, no error but the tooltip remain.

I check also a lot of others libqtip addons and I see they have the line colored when there is a script running on the cell or on the line even if I see no evidence in the code, while I was not able to reproduce it.

I am missing something but even if I have read and search a lot I could not figure out the solution for the problem.

Every input is welcome as usually.
Thanks so much at everyone.
__________________
This is Unix-Land. In quiet nights, you can hear the Windows machines reboot.
  Reply With Quote