Quantcast
AH search text addon breaks the auctioneer - WoWInterface
 
Thread Tools Display Modes
07-02-20, 06:49 PM   #1
alikim
A Fallenroot Satyr
Join Date: Jul 2015
Posts: 27
AH search text addon breaks the auctioneer

I want to copy the name of a craftable item from the crafting window to the AH window's search bar, when I click on the items' icon, so I wrote the following macros:


/run TradeSkillFrame.DetailsFrame.Contents.ResultIcon:SetScript("OnClick", function(self, event, ...) local t = {}; C_TradeSkillUI.GetRecipeInfo(TradeSkillFrame.DetailsFrame.selectedRecipeID, t); AuctionHouseFrame.SearchBar.SearchBox:SetText(t.name); end);

It works and does what I want but when I press Search button in the AH window it keeps showing me the yellow rotating circle and nothing happens. The auctioneer stops working altogether and reloading the UI doesn't help - I have to relog to make it work again.

So, what am I doing wrong?

Thank you!
  Reply With Quote
07-03-20, 04:26 AM   #2
Rilgamon
Premium Member
 
Rilgamon's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Sep 2009
Posts: 789
You could try to use HookScript instead of SetScript.
__________________
The cataclysm broke the world ... and the pandas could not fix it!

Last edited by Rilgamon : 07-03-20 at 04:33 AM.
  Reply With Quote
07-03-20, 04:43 AM   #3
alikim
A Fallenroot Satyr
Join Date: Jul 2015
Posts: 27
As I said, the script works, so it's not a problem with attaching a function to a button, which is in a different frame, not the AH one. The AH UI stops working after
Code:
AuctionHouseFrame.SearchBar.SearchBox:SetText(t.name);
Basically, how do you put text into the search text field in the AH window using lua?

Because the line above breaks it to the point that I need to relog to make it work again.

Last edited by alikim : 07-03-20 at 04:48 AM.
  Reply With Quote
07-03-20, 05:16 AM   #4
Kanegasi
A Molten Giant
 
Kanegasi's Avatar
AddOn Author - Click to view addons
Join Date: Apr 2007
Posts: 505
The SetScript part isn't going to affect the AH, you're right, but the suggestion is still valid. SetScript replaces whatever function was on that frame while HookScript adds a function to a frame. When dealing with frames you didn't create, especially Blizzard frames, you should use HookScript.

As for your issue, try using the set search function the UI uses instead of setting the text directly, along with nil protection just in case:

AuctionHouseFrame:SetSearchText(t.name or "")
  Reply With Quote

WoWInterface » Developer Discussions » Lua/XML Help » AH search text addon breaks the auctioneer

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