Quantcast Clicking TradeSkillUI header items - WoWInterface
 
Thread Tools Display Modes
08-01-16, 01:31 PM   #1
Ketho
A Molten Giant
 
Ketho's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2010
Posts: 884
Clicking TradeSkillUI header items

When you shift-leftclick a header item in the TradeSkill window (without any addons enabled)

It will call C_TradeSkillUI.GetRecipeLink() and pass a nil value

https://github.com/Gethe/wow-ui-sour....xml#L201-L211
Code:
Date: 2016-08-01 21:20:39
ID: 1
Error occured in: Global
Count: 1
Message: [string "*:OnClick"] line 2:
   Usage: GetRecipeLink(recipeID)
Debug:
   [C]: GetRecipeLink()
   [string "*:OnClick"]:2:
      [string "*:OnClick"]:1
Locals:
(*temporary) = nil

AddOns:
  Swatter, v5.21f.5579 (SanctimoniousSwamprat)
  BlizRuntimeLib_enUS v7.0.3.70000 <none>
  (ck=59)




Would something like this work?
Code:
<OnClick>
	if IsModifiedClick() then
		if not self.isHeader then
			HandleModifiedItemClick(C_TradeSkillUI.GetRecipeLink(self.tradeSkillInfo.recipeID));
		end
	else
		if self.isHeader then
			self:GetParent():GetParent():OnHeaderButtonClicked(self, self.tradeSkillInfo, button);
		else
			self:GetParent():GetParent():OnRecipeButtonClicked(self, self.tradeSkillInfo, button);
		end
	end
</OnClick>

Last edited by Ketho : 08-01-16 at 01:43 PM.
 
08-02-16, 08:54 AM   #2
Phanx
Cat.
 
Phanx's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2006
Posts: 5,617
I fixed it in BlizzBugsSuck by ignoring modifier keys on header rows, so if you shift-click a header, it acts like you clicked without the shift. Doing nothing when shift-clicking a header is a little confusing, because the button has visual feedback on mousedown/mouseup.

The Blizzard code is probably best fixed this way:
Code:
<OnClick>
	if self.isHeader then
		self:GetParent():GetParent():OnHeaderButtonClicked(self, self.tradeSkillInfo, button);
	elseif IsModifiedClick() then
		HandleModifiedItemClick(C_TradeSkillUI.GetRecipeLink(self.tradeSkillInfo.recipeID));
	else
		self:GetParent():GetParent():OnRecipeButtonClicked(self, self.tradeSkillInfo, button);
	end
</OnClick>
__________________
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 : 08-02-16 at 08:57 AM.
 
09-21-16, 01:59 PM   #3
Ketho
A Molten Giant
 
Ketho's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2010
Posts: 884
Blizzard fixed this in patch 7.1, C_TradeSkillUI.GetRecipeLink() also won't throw an error when passed nil
https://www.townlong-yak.com/framexm...n.xml/diff#201

On another note:One thing I'd really like is being able to shift-click tradeskills into the search bar, both from the list and the currently selected tradeskill icon

When (shift-)clicking reagents/materials it would be nice to also jump to any tradeskill/recipe for that reagent

 
09-21-16, 02:12 PM   #4
Ketho
A Molten Giant
 
Ketho's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2010
Posts: 884
I wonder why this was changed in Legion though, previously you could just shift-click anything into the search bar but now you need to have it focused first

https://www.townlong-yak.com/framexm....lua/diff#3816
Code:
@@ -3820,15 +3814,13 @@ function ChatEdit_InsertLink(text)
 		end
 		return true;
 	end
-	if ( TradeSkillFrame and TradeSkillFrame:IsShown() )  then
+	if ( TradeSkillFrame and TradeSkillFrame.SearchBox:HasFocus() )  then
 		local item;
 		if ( strfind(text, "item:", 1, true) ) then
 			item = GetItemInfo(text);

This is what I'm using in FixTradeSkillSearch if anyone is interested
Lua Code:
  1. hooksecurefunc("ChatEdit_InsertLink", function(text) -- shift-clicked
  2.     -- change from SearchBox:HasFocus to :IsShown again
  3.     if text and TradeSkillFrame and TradeSkillFrame:IsShown() then
  4.         local spellId = strmatch(text, "enchant:(%d+)")
  5.         local spell = GetSpellInfo(spellId)
  6.         local item = GetItemInfo(strmatch(text, "item:(%d+)") or 0)
  7.         local search = spell or item
  8.         if not search then return end
  9.        
  10.         TradeSkillFrame.SearchBox:SetText(search)
  11.        
  12.         -- jump to the recipe
  13.         if spell then -- can only select recipes on the learned tab
  14.             if PanelTemplates_GetSelectedTab(TradeSkillFrame.RecipeList) == 1 then
  15.                 TradeSkillFrame:SelectRecipe(tonumber(spellId))
  16.             end
  17.         elseif item then
  18.             C_Timer.After(.1, function() -- wait a bit or we cant select the recipe yet
  19.                 for _, v in pairs(TradeSkillFrame.RecipeList.dataList) do
  20.                     if v.name == item then
  21.                         TradeSkillFrame:SelectRecipe(v.recipeID)
  22.                         return
  23.                     end
  24.                 end
  25.             end)
  26.         end
  27.     end
  28. end)
  29.  
  30. -- increase search box width (up from 112)
  31. TradeSkillFrame.SearchBox:SetWidth(200)
  32.  
  33. -- make it only split stacks with shift-rightclick if the TradeSkillFrame is open
  34. -- shift-leftclick should be reserved for the search box
  35. hooksecurefunc("ContainerFrameItemButton_OnModifiedClick", function(self, button)
  36.     if TradeSkillFrame and TradeSkillFrame:IsShown() then
  37.         if button == "LeftButton" then
  38.             StackSplitFrame:Hide()
  39.         end
  40.     end
  41. end)

But the "jumping" to tradeskill part doesn't seem to work anymore in 7.1 when clicking reagents while shift is pressed, maybe have to hook something else now
 
 

WoWInterface » Site Forums » Archived Beta Forums » Legion Beta archived threads » Clicking TradeSkillUI header items

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