WoWInterface

WoWInterface (https://www.wowinterface.com/forums/index.php)
-   General Authoring Discussion (https://www.wowinterface.com/forums/forumdisplay.php?f=20)
-   -   LFG Applicant Tooltip hook? (https://www.wowinterface.com/forums/showthread.php?t=56187)

Healingz 04-27-18 10:54 PM

LFG Applicant Tooltip hook?
 
Hi,

Complete addon newbie here. I was wondering if it was possible to add text to the LFG applicant tooltip in a similar way as player mouseover tooltip?

Lua Code:
  1. local function testText(self)
  2. local name, unit = self:GetUnit()
  3.     if unit then
  4.         GameTooltip:AddLine("New Text Added!", 1, 0.49, 0.04)
  5.     end
  6. end
  7. GameTooltip:HookScript("OnTooltipSetUnit", testText)

This works fine but was wondering how i could adapt this to the LFG applicant tooltip as well.

Thanks!

jeffy162 04-28-18 04:11 AM

Get your applicant tooltip to show, then type "/fstack" (you might have to make it "/framestack", it's the same thing, oh, and leave the quotes out - I just put them there :o ), hit "enter" and put your mouse over the tooltip. This'll give you a new window in one corner of your screen with everything that is under your cursor. In that information will be the name of the tooltip that you're looking for.

Type it again to stop it.

Seerah 04-28-18 11:15 AM

(psst - your mouse can't go over a tooltip ;) )

JDoubleU00 04-28-18 11:28 AM

Quote:

Originally Posted by Seerah (Post 327787)
(psst - your mouse can't go over a tooltip ;) )

This has the makings of an April Fools addon, which we should totally do next year. We come up with addons that sound awesome, but have no chance in Blizzard to work.

jeffy162 04-28-18 01:15 PM

Oh, my bad! But, you know, I could have sworn.....

Healingz 04-28-18 02:23 PM

Yeah. I tried the /fstack tooltip mouseover and learned quickly lol.

The toooltip from LFG Applicants seem to be brought up by LFGListApplicationViewerScrollFrameButton1, LFGListApplicationViewerScrollFrameButton2, etc....

I cannot figure out how to hook into the tooltip in that section though unlike the code i posted above.

I thought something like
Lua Code:
  1. LFGListApplicationViewerScrollFrameButton1:HookScript("OnEnter", addLFGTooltipText)
might work, but I haven't had any success.

Fizzlemizz 04-28-18 02:57 PM

See if the inherited template or function that creates LFGListApplicationViewerScrollFrameButton 1 to x calls a function in the OnEnter script and if so, use hooksecurefunc on that rather than trying to find each buttons OnEnter.

Edit: It doesn't .

Fizzlemizz 04-28-18 03:44 PM

Code:

LFGListApplicationViewerScrollFrameButton1
doesn't have a OnEnter script,
Code:

LFGListApplicationViewerScrollFrameButton1.InviteButton
does

Phanx 05-06-18 02:30 PM

For things like this, rather than targeting specific objects by name in a list whose members are dynamically created, just hook the function that updates all the objects in the list, and hook each object if it isn't already hooked; this will catch new objects as they are created.

Code:

local hooked = {}

local function OnEnterHook(self)
        if not self.tooltip then
                -- The original OnEnter script doesn't show a tooltip in this case,
                -- so we should exit here, instead of adding text to a tooltip that
                -- isn't shown or, worse, is currently shown by something else.
                return
        end

        GameTooltip:AddLine("hello world")
        GameTooltip:Show()
end

hooksecurefunc(LFGListApplicationViewer_UpdateResults, function(self)
        local buttons = self.ScrollFrame.buttons
        for i = 1, #buttons do
                local button = buttons[i]
                if not hooked[button] then
                        button:HookScript("OnEnter", OnEnterHook)
                        hooked[button] = true
                end
        end
end)

If you need to get information about the result the tooltip is displayed for, the "self" in the OnEnterHook function refers to the InviteButton, which has an "applicantID" property, which can be passed to other functions to get whatever info you're looking for. See the LFGListApplicationViewer_UpdateApplicant function for examples of getting the info; the "id" parameter passed into that function is your "applicantID".

Healingz 05-21-18 11:37 AM

Thank you so much Phanx! :)


All times are GMT -6. The time now is 02:58 PM.

vBulletin © 2024, Jelsoft Enterprises Ltd
© 2004 - 2022 MMOUI