Thread Tools Display Modes
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
03-19-20, 01:34 PM   #2
Fizzlemizz
I did that?
 
Fizzlemizz's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Dec 2011
Posts: 1,871
Doing an OnEnter on the frame on top causes an OnLeave for the frame underneath it which would cause the closure of your information frame.

I don't know LibQTip or what else you might be using but you would need to implement a mouse check for the OnLeave to check if the mouse is still over the frame or not before closing

eg.
Code:
frame:SetScript("OnLeave" function(self)
    if not self:IsMouseOver() then
        -- do whatever to hide
    end
end)
I don't know the best way to do it for you but it seems you have some time to play
Take care and be safe.
__________________
Fizzlemizz
Maintainer of Discord Unit Frames and Discord Art.
Author of FauxMazzle, FauxMazzleHUD and Move Pad Plus.
  Reply With Quote
03-19-20, 02:11 PM   #3
gmarco
An Onyxian Warder
 
gmarco's Avatar
AddOn Author - Click to view addons
Join Date: Dec 2009
Posts: 362
Hi Fizzlemizz,

If I enter the databroker the tooltip correctly appears.
I can then move out the tooltip and it correctly disappears or I can move inside it and it correctly stay.

But if I move on THIS line:

Lua Code:
  1. row,col = tooltip:AddLine("var1","var2","var3","var4")
  2. tooltip:SetLineScript(row, 'OnMouseDown', Button_OnClick, "var1")

and only on this the tooltip wrongly disappears.

The function never prints: "Never arrives here" so probably it doesnt get there.

And as I wrote if I remove the function the tooltip doesn't disappears.

I think what you say can be applied for me if I move out to the tooltip but I dont move out of it ...
Or the "SetLineScript" add a more one different frame on the line ?!?

Thanks for your help so much appreciated.

P.s.
Thanks also for your attention too
__________________
This is Unix-Land. In quiet nights, you can hear the Windows machines reboot.
  Reply With Quote
03-19-20, 02:50 PM   #4
Fizzlemizz
I did that?
 
Fizzlemizz's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Dec 2011
Posts: 1,871
Really just a stab in the dark but possibly you need something that stops the dataobj.OnLeave parent call doing it's default thing (presumably hiding the data frame)

Try doing this as a test which should print when you mouse over the line.
Code:
dataobj.OnLeave = function(self)
 	print("Leaving/Hiding broker frame. MouseOver =", self:IsMouseOver())
      -- Null operation: Some LDB displays get cranky if this method is missing.
end
The SetLineScript sets an OnEnter for the row highlight frame which posts an OnLeave to your data opbject.

Hopefully someone knows these libraries better than I or if you know of a LDB addon that uses LibQTip the way you expect, you could look at how they did it.
__________________
Fizzlemizz
Maintainer of Discord Unit Frames and Discord Art.
Author of FauxMazzle, FauxMazzleHUD and Move Pad Plus.

Last edited by Fizzlemizz : 03-19-20 at 02:58 PM.
  Reply With Quote
03-19-20, 03:41 PM   #5
gmarco
An Onyxian Warder
 
gmarco's Avatar
AddOn Author - Click to view addons
Join Date: Dec 2009
Posts: 362
Hi,
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.     tooltip:SetHighlightTexture(1,1,0,.2)
  28.    
  29.     row,col = tooltip:Show()
  30.     tooltip:SetScript("OnLeave", function(self)
  31.     self:Release()
  32.     tooltip = nil
  33.     print("Release tooltip")
  34.     end)
  35.  
  36. end
  37.  
  38. dataobj.OnEnter = function(self)
  39.     anchor_OnEnter(self)
  40. end
  41.  
  42. dataobj.OnLeave = function(self)
  43.     print("Leaving/Hiding broker frame")
  44.     -- Null operation: Some LDB displays get cranky if this method is missing.
  45. end

The only print() that triggers when I mouse over the line with scripts is:

Lua Code:
  1. print("Release tooltip")

Can you explain better what you mean by:

The SetLineScript sets an OnEnter for the row highlight frame which posts an OnLeave to your data opbject.

I didn't find any references of this highlight frame in the libqtip docs.

And I really dont understand what I am doing wrong because all the others addons I am looking seems so similar to mine ... The only differences is that the others works as expected
And it is really frustrating )

Thanks so much for any help )
__________________
This is Unix-Land. In quiet nights, you can hear the Windows machines reboot.
  Reply With Quote
03-19-20, 04:23 PM   #6
Vrul
A Scalebane Royal Guard
 
Vrul's Avatar
AddOn Author - Click to view addons
Join Date: Nov 2007
Posts: 404
You are setting an OnLeave script for the tooltip which is triggered by the OnEnter script within the tooltip. You want to set an OnRelease handler instead:
Code:
local ADDON = ...

local tooltip

local LibQTip = LibStub('LibQTip-1.0')

local function Button_OnClick(rowline, name, button)
    print("Never arrives here")
end

local function LoadTooltip()
    local row,col = tooltip:AddHeader()
    tooltip:SetCell(row,1,ADDON,"LEFT",4)
    
    row,col = tooltip:AddLine("var1","var2","var3","var4")
    tooltip:SetLineScript(row, 'OnMouseDown', Button_OnClick, "var1")   
    tooltip:SetHighlightTexture(1,1,0,.2)
end

local function OnRelease(self)
    tooltip = nil 
    print("Release tooltip")
end

local dataobj = LibStub("LibDataBroker-1.1"):NewDataObject(ADDON, {
    type = "data source",
    icon = "Interface\\Addons\\"..ADDON.."\\icon.tga",
    text = "-",

    OnEnter = function(self)
        if tooltip then return end
        tooltip = LibQTip:Acquire(ADDON.."tip", 4, "LEFT", "LEFT", "LEFT","LEFT")
        tooltip:EnableMouse(true)
        tooltip:SmartAnchorTo(self)
        tooltip.OnRelease = OnRelease
        tooltip:SetAutoHideDelay(1, self)
        LoadTooltip()
        tooltip:Show()
    end,

    OnLeave = function(self, motion)
        print("Leaving/Hiding broker frame")
        if tooltip and not motion then
            tooltip:Release()
        end
    end
})
  Reply With Quote
03-19-20, 05:21 PM   #7
gmarco
An Onyxian Warder
 
gmarco's Avatar
AddOn Author - Click to view addons
Join Date: Dec 2009
Posts: 362
Hi Vrul,

thanks so much for your help, but with your code I am unable to enter in the tooltip.

when I leave the databroker area to enter in the tooltip it disappears.

Have I miss something ?

Thanks.
__________________
This is Unix-Land. In quiet nights, you can hear the Windows machines reboot.
  Reply With Quote
03-19-20, 05:43 PM   #8
Vrul
A Scalebane Royal Guard
 
Vrul's Avatar
AddOn Author - Click to view addons
Join Date: Nov 2007
Posts: 404
If you copied the code exactly I don't see why it wouldn't work as it works fine for me.
  Reply With Quote
03-19-20, 06:02 PM   #9
gmarco
An Onyxian Warder
 
gmarco's Avatar
AddOn Author - Click to view addons
Join Date: Dec 2009
Posts: 362
Hi Vrul,

you are right it works ... with your dockingstation

I was testing with chocolatebar and it doesnt works there.
I have also disable all addons and loaded only your code and chocolatebar and it doesnt works.

Probably there is something that breaks with that launcher.
Bah ... I have also delete the WTF but it doesn't works.

I'd like if the code should be compatible with all launchers :/ or users will become crazy

Thanks so much for your help Vrul
__________________
This is Unix-Land. In quiet nights, you can hear the Windows machines reboot.
  Reply With Quote
03-19-20, 06:12 PM   #10
Vrul
A Scalebane Royal Guard
 
Vrul's Avatar
AddOn Author - Click to view addons
Join Date: Nov 2007
Posts: 404
Try getting rid of the code within the data broker OnLeave script. Maybe Chocolate bar doesn't pass the motion argument and that is the issue.
  Reply With Quote
03-19-20, 06:35 PM   #11
gmarco
An Onyxian Warder
 
gmarco's Avatar
AddOn Author - Click to view addons
Join Date: Dec 2009
Posts: 362
I think you got it !!!

I was testing all the other databroker and all had the same behaviour.
Now I removed that part of code and almost everything works )))

The last problem is the tooltip doesn't disappear and last forever.
Have I removed too much in the OnLeave ?

BTW: thanks so much Vrul and everyone in this forum for patience and time.
__________________
This is Unix-Land. In quiet nights, you can hear the Windows machines reboot.

Last edited by gmarco : 03-19-20 at 06:38 PM.
  Reply With Quote
03-19-20, 07:44 PM   #12
Vrul
A Scalebane Royal Guard
 
Vrul's Avatar
AddOn Author - Click to view addons
Join Date: Nov 2007
Posts: 404
Originally Posted by gmarco View Post
The last problem is the tooltip doesn't disappear and last forever.
Have I removed too much in the OnLeave ?
Yeah, change it to this:
Code:
    OnLeave = function(self, motion)
        print("Leaving/Hiding broker frame")
        if tooltip and not tooltip:IsMouseOver() then
            tooltip:Release()
        end
    end
  Reply With Quote
03-19-20, 07:58 PM   #13
gmarco
An Onyxian Warder
 
gmarco's Avatar
AddOn Author - Click to view addons
Join Date: Dec 2009
Posts: 362
Thanks so much Vrul.

Now it seems everything is fine.
Tomorrow morning I double check everything and let you know

Now it's time to go in bed it's 3 AM here (eheheh

Thanks again !!!!
__________________
This is Unix-Land. In quiet nights, you can hear the Windows machines reboot.
  Reply With Quote
03-20-20, 03:45 AM   #14
gmarco
An Onyxian Warder
 
gmarco's Avatar
AddOn Author - Click to view addons
Join Date: Dec 2009
Posts: 362
Hi all,

everything is working ... thanks so much to everyone.

After all your help and suggestions I made a little addon to manage guild and friends.
Not so much features, but for my needs it is more than enough.

Here is the definitive screenshot.
No ingame configs.



The addon is in attach I'll publish it after my guild wake up an do a little bit more tests

Thanks to everyone again.
Attached Files
File Type: zip gmGuildFriends-830-2020032001.zip (19.3 KB, 75 views)
__________________
This is Unix-Land. In quiet nights, you can hear the Windows machines reboot.

Last edited by gmarco : 03-20-20 at 04:11 AM.
  Reply With Quote
03-20-20, 01:59 PM   #15
myrroddin
A Pyroguard Emberseer
 
myrroddin's Avatar
AddOn Author - Click to view addons
Join Date: Oct 2008
Posts: 1,240
You can replace your header names with Blizzard global strings; that way they will be translated plus look correct with capitalization without you doing all the work.
Code:
-- old --            -- new --
"name"              NAME
"level"               LEVEL
"zone"               ZONE
"rank"               RANK
"class"              CLASS
"battleTag"        BATTLETAG
https://www.townlong-yak.com/framexm...balStrings.lua

Last edited by myrroddin : 03-20-20 at 02:03 PM. Reason: found another one
  Reply With Quote
03-20-20, 08:38 PM   #16
gmarco
An Onyxian Warder
 
gmarco's Avatar
AddOn Author - Click to view addons
Join Date: Dec 2009
Posts: 362
Hi,

I did it infact in the version I published:


Lua Code:
  1. -- GUILD
  2. row,col = tooltip:AddLine(_G["NAME"],_G["LEVEL"],_G["ZONE"],_G["RANK"])
  3.  
  4. -- BNET
  5. row,col = tooltip:AddLine(_G["NAME"],_G["BATTLETAG"],_G["ZONE"],_G["GAME"])
  6.  
  7. -- FRIENDS
  8. row,col = tooltip:AddLine(_G["NAME"],_G["LEVEL"],_G["ZONE"],_G["CLASS"])

I have find some problems in the color by class because the C_BattleNet.GetFriendAccountInfo return the class name in the format not suitable for checking the raid colors (especially if you have a non english client).

But I have found a snippet by phanx (which I miss so much really that works great to fix this.

Lua Code:
  1. local classes = {}
  2. for class in pairs(RAID_CLASS_COLORS) do
  3.    tinsert(classes, class)
  4. end
  5. sort(classes)
  6.  
  7. local classTokens = {}
  8. for token, class in pairs(LOCALIZED_CLASS_NAMES_MALE) do
  9.    classTokens[class] = token
  10. end
  11. for token, class in pairs(LOCALIZED_CLASS_NAMES_FEMALE) do
  12.    classTokens[class] = token
  13. end
  14.  
  15. function GetClassToken(className)
  16.    return className and classTokens[className]
  17. end

In this way the GetClassToken(class) works always for class coloring the names and do the jobs always instead of my ugly solution I have found and that works only in english clients.

Lua Code:
  1. class = strupper(class):gsub("%s+","")

BTW: if you want to check it is here:
https://www.wowinterface.com/downloa...ldFriends.html

Any comments are welcome.
Thanks so much for your time.
__________________
This is Unix-Land. In quiet nights, you can hear the Windows machines reboot.
  Reply With Quote

WoWInterface » Developer Discussions » Lua/XML Help » LibQTip tooltip hides when there is a script on line or cell

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off