WoWInterface

WoWInterface (https://www.wowinterface.com/forums/index.php)
-   General Authoring Discussion (https://www.wowinterface.com/forums/forumdisplay.php?f=20)
-   -   Get AH Listing on Mouse Hover (https://www.wowinterface.com/forums/showthread.php?t=57610)

Cannonpwns 10-16-19 05:12 PM

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.

Vrul 10-16-19 06:01 PM

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.

Cannonpwns 10-16-19 06:07 PM

That's awesome! Thanks so much.


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

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