Thread: darn taint
View Single Post
01-24-10, 11:38 PM   #9
Dayve
A Deviate Faerie Dragon
AddOn Author - Click to view addons
Join Date: Jul 2008
Posts: 15
I managed to accomplish this in my own unit/raid frames by parenting the party frames to one frame and hiding that frame using a SecureHandlerStateTemplate (which also doubles as the main table for the addon).
Creation:
lua Code:
  1. local main = CreateFrame("Frame", "DayveUF_Main", UIParent, "SecureHandlerStateTemplate");
  2. SecureHandler_OnLoad(main);
  3. main.partyMain = CreateFrame("Frame", nil, main);
Initialisation:
lua Code:
  1. self:SetFrameRef("PartyMain", self.partyMain);
  2. self:Execute([[
  3.     PartyMain = self:GetFrameRef("PartyMain");
  4. ]]);
  5. self:SetAttribute("_onstate-unitexists", [[
  6.     if raidhideparty and newstate then
  7.         PartyMain:Hide()
  8.     else
  9.         PartyMain:Show()
  10.     end
  11. ]]);
  12. self:SetAttribute("unit", "raid1");
  13. RegisterUnitWatch(self, true);
And to turn the behaviour on or off to reflect the user's setting:
lua Code:
  1. self:Execute(self.save.raidhideparty and [[
  2.     raidhideparty = true;
  3. ]] or [[
  4.     raidhideparty = false;
  5. ]]);
  6. self:SetAttribute("state-unitexists", UnitExists("raid1"));
  Reply With Quote