im using:
Code:
-- Hider Secure (mostly used to hide stuff while in pet battle)
local PetBattleHider = CreateFrame("Frame", "TukuiPetBattleHider", UIParent, "SecureHandlerStateTemplate");
PetBattleHider:SetAllPoints(UIParent)
RegisterStateDriver(PetBattleHider, "visibility", "[petbattle] hide; show")
And I parent everything on My UI that I want to hide while in pet battle to it when the addon load, except for my action bars which I use [petbattle] macro.