Quantcast Get AH Listing on Mouse Hover - WoWInterface
Thread Tools Display Modes
10-16-19, 05:12 PM   #1
Cannonpwns
A Defias Bandit
AddOn Author - Click to view addons
Join Date: Aug 2019
Posts: 2
Get AH Listing on Mouse Hover

I want to call the GetAuctionItemInfo api on mouse hover of an auction listing. I thought I could grab the ah index off of the frame name but I can't do that reliably.

Lua Code:
  1. local function SetGameToolTipPrice(tt) 
  2.  
  3.     if (AuctionFrameBrowse:IsVisible()) then
  4.  
  5.         local container = GetMouseFocus()
  6.         local ahIndex = container:GetName()
  7.    
  8.         --Prints "BrowseButton1Item", "BrowseButton2Item", "BrowseButton3Item", etc.
  9.         --up until 8 (max items viewable without scrolling)!
  10.         print(ahIndex)
  11.        
  12.         --call GetAuctionItemInfo(), with index stripped from ahIndex
  13.     end
  14. end
  15.  
  16. GameTooltip:HookScript("OnTooltipSetItem", SetGameToolTipPrice)

This works perfect if the listing is only a few items and has no scrollbar. The problem occurs when scrolling down a listing, the "first" listing you see is always "BrowseButton1Item" and the "last" is always "BrowseButton8Item". This leaves me without a useful index to call GetAuctionItemInfo with.

Last edited by Cannonpwns : 10-16-19 at 05:31 PM.
  Reply With Quote
10-16-19, 06:01 PM   #2
Vrul
A Rage Talon Dragon Guard
 
Vrul's Avatar
AddOn Author - Click to view addons
Join Date: Nov 2007
Posts: 312
Based on Blizzard's code you can add the return of FauxScrollFrame_GetOffset(BrowseScrollFrame) to your ahIndex to get the value you are looking for.
  Reply With Quote
10-16-19, 06:07 PM   #3
Cannonpwns
A Defias Bandit
AddOn Author - Click to view addons
Join Date: Aug 2019
Posts: 2
That's awesome! Thanks so much.
  Reply With Quote

WoWInterface » Developer Discussions » General Authoring Discussion » Get AH Listing on Mouse Hover

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