I've recently turned up a bug in my addon
CRAP. CRAP functions as a replacement for Blizzard's companions UI (the Companions and Mounts tabs of the Pets frame), and to get my setup into place, I found it most convenient to simply hide Blizzard's bits and pieces (the PetPaperDollFrameCompanionFrame) and hook the OnClick scripts for the Mounts/Pets tab buttons.
The PetPaperDollFrameCompanionFrame is implicitly protected by the twelve CompanionButton
Ns. In order to keep those and the PPDFCF hidden, I (along with
the help of some kind folks over at WowAce) came up with this snippet, which
seemed to keep everything hidden nicely.
Code:
for i=1,12 do
SecureHandlerWrapScript(_G["CompanionButton"..i], "OnShow", _G["CompanionButton"..i],
[[ self:Hide() self:GetParent():Hide() ]])
end
And I just recently discovered that it's not quite working perfectly. First, this is the snippet that manages hooking the tab buttons:
Code:
-- "Pet" button
PetPaperDollFrameTab1:HookScript("OnClick", function(self)
FUR:Hide(); -- FUR is the frame that I use for listing companions/mounts
end)
-- "Companions" button
PetPaperDollFrameTab2:HookScript("OnClick", function(self)
COMPANIONTYPE = "CRITTER"
sortbutton:Disable()
scrollbar:SetMinMaxValues(0, math.max(0, GetNumCompanions(COMPANIONTYPE) - NUMROWS))
scrollbar:SetValue(0)
Show(); -- This just does a bit of background work before calling FUR:Show()
end)
-- "Mounts" button
PetPaperDollFrameTab3:HookScript("OnClick", function(self)
COMPANIONTYPE = "MOUNT"
sortbutton:Enable()
scrollbar:SetMinMaxValues(0, math.max(0, GetNumCompanions(COMPANIONTYPE) - NUMROWS))
scrollbar:SetValue(0)
Show();
end)
When my frame first shows, the script on CompanionButton1 fires. However, it seems to die at that point - if you click on Tab2 or Tab3, the script on Button2 (and
only Button2) will fire. So on and so forth until after twelve clicks on Tab2 and/or Tab3, there are no more CompanionButtons firing their script and the Blizzard UI shows up underneath mine. Interestingly, only the PPDFCF shows up - the CompanionButtons remain hidden.
So, what the hell am I doing wrong, what have I missed? I've got a hunch this has something to do with tainting issues, simply because secure frames are involved, and quite honestly, I'm lost when it comes to secure handlers/headers (and I'm not really sure what those terms are or mean). I'd appreciate any guidance.