View Single Post
02-20-14, 01:28 PM   #2
Duugu
Premium Member
 
Duugu's Avatar
AddOn Author - Click to view addons
Join Date: Nov 2006
Posts: 851
You could hook the OnClick event of the frames.


Lua Code:
  1. for container = 1, 5 do
  2.     for item = 1, 36 do
  3.         _G["ContainerFrame"..container.."Item"..item]:HookScript("OnClick", function(self, button)
  4.             if IsShiftKeyDown() and button == "MiddleButton" then
  5.                 print(GetItemInfo(GetContainerItemID(self:GetParent():GetID(), self:GetID())))
  6.             end
  7.         end)
  8.     end
  9. end

Another way doing it would be to hook Blizzards ContainerFrameItemButton_OnModifiedClick(self, button).

Like

Lua Code:
  1. hooksecurefunc("ContainerFrameItemButton_OnModifiedClick", function(self, button)
  2.             if IsShiftKeyDown() and button == "MiddleButton" and self:GetParent():GetID() <= 5 then
  3.                 print(GetItemInfo(GetContainerItemID(self:GetParent():GetID(), self:GetID())))
  4.             end
  5.         end)

I bet Phanx likes this one more because it's using only one hook and not 5x36. ;D

Last edited by Duugu : 02-20-14 at 01:47 PM.
  Reply With Quote