Quantcast
WoWInterface - View Single Post - about 'SecureGroupHeaderTemplate'
View Single Post
08-03-16, 02:05 AM   #1
Layback_
An Onyxian Warder
Join Date: Feb 2016
Posts: 356
about 'SecureGroupHeaderTemplate'

Hi all,

I finally started to make party frame with oUF and here's what it looks so far.

Lua Code:
  1. C.Party = oUF:SpawnHeader(
  2.     "testParty",
  3.     nil,
  4.     "custom [group:party,nogroup:raid] show; hide",
  5.     -- attributes
  6.     "initial-width", G["unitframe"]["party"]["width"],
  7.     "initial-height", G["unitframe"]["party"]["height"],
  8.     "oUF-initialConfigFunction", [[
  9.         local header = self:GetParent();
  10.         self:SetWidth(header:GetAttribute("initial-width"));
  11.         self:SetHeight(header:GetAttribute("initial-height"));
  12.     ]],
  13.     "showRaid", false,
  14.     "showParty", true,
  15.     "showSolo", false,
  16.     "showPlayer", true,
  17.     "point", "TOP",
  18.     "xOffset", 0,
  19.     "yOffset", -40
  20. );
  21. C.Party:SetPoint(unpack(G["unitframe"]["party"]["point"]));

The one thing that I am currently unhappy with is that it adds "UnitButton" to each party frame's name.



I thought this was because of "SecureGroupHeaderTemplate", thus I have dug into Blizzard's interface code and found the following lines of code from SecureGroupHeaders.lua

Lua Code:
  1. -- ensure there are enough buttons
  2. local needButtons = max(1, numDisplayed);
  3. if not ( self:GetAttribute("child"..needButtons) ) then
  4.     local buttonTemplate = self:GetAttribute("template");
  5.     local templateType = self:GetAttribute("templateType") or "Button";
  6.     local name = self:GetName();
  7.     for i = 1, needButtons, 1 do
  8.         local childAttr = "child" .. i;
  9.         if not ( self:GetAttribute(childAttr) ) then
  10.             local newButton = CreateFrame(templateType, name and (name.."UnitButton"..i), self, buttonTemplate);
  11.             self[i] = newButton;
  12.             SetupUnitButtonConfiguration(self, newButton);
  13.             setAttributesWithoutResponse(self, childAttr, newButton, "frameref-"..childAttr, GetFrameHandle(newButton));
  14.         end
  15.     end
  16. end

To be honest, I don't think I can create my own custom template with my current skills, but really would like to get rid of that "UnitButton" text from frame's name.

If anyone could suggest a workaround, I would really appreciate it!

Thank you.
  Reply With Quote