Slightly Smarter TradeSkill

The Proper Fix

I'm going to rant briefly on the way that problem #2 should be fixed, if anybody wants to try approximating a solution that doesn't require mucking about with secure frames and/or write access to Blizzard's source repo.

Using the default shift-click to paste into the search box would have been fine, except that the code (as of 4.0.6) only checks whether the tradeskill window is visible. It does not check whether the search box has cursor focus (i.e., the cursor is in the box blinking). There is no existing API to test whether an editbox has focus, but that's easy to work around:

Step 1: If you were Blizzard, you could edit the tradeskill XML around line 1175, otherwise you have to do this:

TradeSkillFrameSearchBox:HookScript("OnEditFocusGained", function(self) self.hasFocus = true end)
TradeSkillFrameSearchBox:HookScript("OnEditFocusLost", function(self) self.hasFocus = nil end)

Step 2: Edit the ContainerFrameItemButton_OnModifiedClick function. You have to be Blizzard for this part, or do some unholy twiddling with secure templates, or say screw-it-all and just replace the function and taint everydamnthing everywhere. Change line 780

if ( TradeSkillFrame and TradeSkillFrame:IsShown() and IsModifiedClick("TRADESEARCHADD") )  then

with (split into three lines to highlight the change)

if ( TradeSkillFrame and TradeSkillFrame:IsShown()
    and TradeSkillFrameSearchBox.hasFocus       --   add this bit in the middle of the condition chain
    and IsModifiedClick("TRADESEARCHADD") )  then

Then half of this cheesy addon could go away, and shift-clicking would always Do The Right Thing in a context-sensitive manner. </rant>

You must login to post a comment. Don't have an account? Register to get one!

  • 1 comment
  • 1 comment


Date created
Mar 19, 2011
Last updated
Jul 15, 2012