Quantcast
about 'SecureGroupHeaderTemplate' - WoWInterface
Thread Tools Display Modes
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
08-03-16, 03:15 AM   #2
Torhal
A Pyroguard Emberseer
 
Torhal's Avatar
AddOn Author - Click to view addons
Join Date: Aug 2008
Posts: 1,196
Why, though? Are you going to be displaying the frame's name in-game? This is really just an implementation detail that allows you to more easily target those frames using code.
__________________
Whenever someone says "pls" because it's shorter than "please", I say "no" because it's shorter than "yes".

Author of NPCScan and many other AddOns.
  Reply With Quote
08-03-16, 03:32 AM   #3
Layback_
An Onyxian Warder
Join Date: Feb 2016
Posts: 356
Originally Posted by Torhal View Post
Why, though? Are you going to be displaying the frame's name in-game? This is really just an implementation detail that allows you to more easily target those frames using code.
Hi Torhal,

Yeah, you are totally right. Changing the name of the frame won't improve any of game performances and I won't be displaying the name in-game like you said.

I honestly dunno how I should explain this, but arrrrrr.... I don't know....
(Could possibly be 'mysophobia' thing...)

If there is no such straightforward solution that is totally fine

Thank you for your reply!
  Reply With Quote

WoWInterface » Featured Projects » oUF (Otravi Unit Frames) » about 'SecureGroupHeaderTemplate'

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off