Quantcast LFG Applicant Tooltip hook? - WoWInterface
Thread Tools Display Modes
04-27-18, 10:54 PM   #1
Healingz
A Defias Bandit
 
Healingz's Avatar
Join Date: Aug 2016
Posts: 3
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!

Last edited by Healingz : 04-27-18 at 11:01 PM.
  Reply With Quote
04-28-18, 04:11 AM   #2
jeffy162
A Pyroguard Emberseer
 
jeffy162's Avatar
AddOn Author - Click to view addons
Join Date: May 2009
Posts: 2,285
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 ), 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.
__________________
Ahhhh, the vagueries of the aging mind. Wait.... What was I saying?


Carbonite <----- GitHub main module (Maps ONLY) download link. The other modules are also available on GitHub.
  Reply With Quote
04-28-18, 11:15 AM   #3
Seerah
Fishing Trainer
 
Seerah's Avatar
WoWInterface Super Mod
Featured
Join Date: Oct 2006
Posts: 10,556
(psst - your mouse can't go over a tooltip )
__________________
"You'd be surprised how many people violate this simple principle every day of their lives and try to fit square pegs into round holes, ignoring the clear reality that Things Are As They Are." -Benjamin Hoff, The Tao of Pooh

  Reply With Quote
04-28-18, 11:28 AM   #4
JDoubleU00
An Onyxian Warder
 
JDoubleU00's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2008
Posts: 356
Originally Posted by Seerah View Post
(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.
__________________
Author of JWExpBar and JWRepBar.
  Reply With Quote
04-28-18, 01:15 PM   #5
jeffy162
A Pyroguard Emberseer
 
jeffy162's Avatar
AddOn Author - Click to view addons
Join Date: May 2009
Posts: 2,285
Oh, my bad! But, you know, I could have sworn.....
__________________
Ahhhh, the vagueries of the aging mind. Wait.... What was I saying?


Carbonite <----- GitHub main module (Maps ONLY) download link. The other modules are also available on GitHub.
  Reply With Quote
04-28-18, 02:23 PM   #6
Healingz
A Defias Bandit
 
Healingz's Avatar
Join Date: Aug 2016
Posts: 3
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.
  Reply With Quote
04-28-18, 02:57 PM   #7
Fizzlemizz
I did that?
 
Fizzlemizz's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Dec 2011
Posts: 932
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
Maintainer of Discord Unit Frames and Discord Art.
Author of FauxMazzle and Move Pad Plus.

Last edited by Fizzlemizz : 04-28-18 at 03:18 PM.
  Reply With Quote
04-28-18, 03:44 PM   #8
Fizzlemizz
I did that?
 
Fizzlemizz's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Dec 2011
Posts: 932
Code:
LFGListApplicationViewerScrollFrameButton1
doesn't have a OnEnter script,
Code:
LFGListApplicationViewerScrollFrameButton1.InviteButton
does
__________________
Fizzlemizz
Maintainer of Discord Unit Frames and Discord Art.
Author of FauxMazzle and Move Pad Plus.
  Reply With Quote
05-06-18, 02:30 PM   #9
Phanx
Cat.
 
Phanx's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2006
Posts: 5,617
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".
__________________
Author/maintainer of Grid, PhanxChat, oUF_Phanx, and many more.
Troubleshoot an addonTurn any code into an addonMore addon resources
Need help with your code? Post all of your actual code! Attach or paste your files.
Please don’t PM me about addon bugs or code questions. Post a comment or forum thread instead!

Last edited by Phanx : 05-23-18 at 01:11 AM.
  Reply With Quote
05-21-18, 11:37 AM   #10
Healingz
A Defias Bandit
 
Healingz's Avatar
Join Date: Aug 2016
Posts: 3
Thank you so much Phanx!
  Reply With Quote

WoWInterface » Developer Discussions » General Authoring Discussion » LFG Applicant Tooltip hook?

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