View Single Post
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